Package hudson.util
Class Iterators
java.lang.Object
hudson.util.Iterators
Varios 
Iterator implementations.- Author:
- Kohsuke Kawaguchi
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfacestatic final classRemove duplicates from another iterator.static classCreates a filtered view of another iterator.static classProduces {A,B,C,D,E,F} from {{A,B},{C},{},{D,E,F}}.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> Iterable<T> CastsIterableby taking advantage of its covariant-ness.static <T> Iterator<T> CastsIteratorby taking advantage of its covariant-ness.static <T> Iterator<T> empty()Returns the empty iterator.static <T> Iterator<T> limit(Iterator<? extends T> base, Iterators.CountingPredicate<? super T> filter) Returns the elements in the base iterator until it hits any element that doesn't satisfy the filter.static <T,U> Iterator <U> Wraps another iterator and map iterable objects.static <T> Iterator<T> Creates a read-only mutator that disallowsIterator.remove().static <T> Iterable<T> removeDups(Iterable<T> base) Filters another iterator by eliminating duplicates.static <T> Iterator<T> removeDups(Iterator<T> iterator) Filters another iterator by eliminating duplicates.static <T> Iterator<T> removeNull(Iterator<T> itr) Wraps another iterator and throws away nulls.static <T> Iterable<T> Returns theIterablethat lists items in the reverse order.reverseSequence(int start, int end) reverseSequence(int start, int end, int step) The short cut forreverse(sequence(start,end,step)).sequence(int start, int end) sequence(int start, int end, int step) Returns a list that represents [start,end).static <T> Iterable<T> static <T> Iterator<T> static voidCallsnext()oniterator, eithercounttimes or untilhasNext()returnsfalse, whichever comes first.static <U,T extends U> 
 Iterator<T> Returns anIteratorthat only returns items of the given subtype.static <T> Iterable<T> Returns anIterablethat lists items in the normal order but which hides the base iterator implementation details.
- 
Constructor Details- 
Iteratorspublic Iterators()
 
- 
- 
Method Details- 
emptyReturns the empty iterator.
- 
reverseReturns theIterablethat lists items in the reverse order.- Since:
- 1.150
 
- 
wrapReturns anIterablethat lists items in the normal order but which hides the base iterator implementation details.- Since:
- 1.492
 
- 
sequenceReturns a list that represents [start,end). For example sequence(1,5,1)={1,2,3,4}, and sequence(7,1,-2)={7.5,3}- Since:
- 1.150
 
- 
sequence
- 
reverseSequenceThe short cut forreverse(sequence(start,end,step)).- Since:
- 1.150
 
- 
reverseSequence
- 
castCastsIteratorby taking advantage of its covariant-ness.
- 
castCastsIterableby taking advantage of its covariant-ness.
- 
subTypeReturns anIteratorthat only returns items of the given subtype.
- 
readOnlyCreates a read-only mutator that disallowsIterator.remove().
- 
removeNullWraps another iterator and throws away nulls.
- 
mapWraps another iterator and map iterable objects.
- 
sequence
- 
removeDupsFilters another iterator by eliminating duplicates.
- 
removeDupsFilters another iterator by eliminating duplicates.
- 
sequence
- 
limitpublic static <T> Iterator<T> limit(Iterator<? extends T> base, Iterators.CountingPredicate<? super T> filter) Returns the elements in the base iterator until it hits any element that doesn't satisfy the filter. Then the rest of the elements in the base iterator gets ignored.- Since:
- 1.485
 
- 
skip@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static void skip(@NonNull Iterator<?> iterator, int count) Callsnext()oniterator, eithercounttimes or untilhasNext()returnsfalse, whichever comes first.- Parameters:
- iterator- some iterator
- count- a nonnegative count
 
 
-