/** * Gets a singleton iterator. * <p> * This iterator is a valid iterator object that will iterate over * the specified object. * * @param <E> the element type * @param object the single object over which to iterate * @return a singleton iterator over the object */ public static <E> ResettableIterator<E> singletonIterator(final E object) { return new SingletonIterator<>(object); }
@Override public Iterator<V> iterator() { return new SingletonIterator<>(parent.getValue(), false); } }
/** * Creates a new FluentIterable of the single provided element. * <p> * The returned iterable's iterator does not support {@code remove()}. * * @param <T> the element type * @param singleton the singleton element * @return a new FluentIterable containing the singleton */ public static <T> FluentIterable<T> of(final T singleton) { return of(IteratorUtils.asIterable(new SingletonIterator<>(singleton, false))); }
/** * Returns the disjuncts in this conjunction. */ public Iterator<IDisjunct> getDisjuncts() { return new SingletonIterator<IDisjunct>( this); }
/** * Returns the assertions for this disjunction. */ public Iterator<IAssertion> getAssertions() { return new SingletonIterator<IAssertion>( this); }
/** * Returns the disjuncts in this conjunction. */ public Iterator<IDisjunct> getDisjuncts() { return new SingletonIterator<IDisjunct>( this); }