code: public static <T> UnmodifiableIterator<T> singletonIterator(final @Nullable T value) {
      return new UnmodifiableIterator<T>() {
        boolean done;
  
        @Override
        public boolean hasNext() {
          return !done;
        }
  
        @Override
        public T next() {
          if (done) {
            throw new NoSuchElementException();
          }
          done = true;
          return value;
        }
      };
    }
docs: Returns an iterator containing only {@code value}.
  
  <p>The {@link Iterable} equivalent of this method is {@link Collections#singleton}.