Package org.carrot2.util
Class IntArrayPredicateIterator
- java.lang.Object
-
- org.carrot2.util.IntArrayPredicateIterator
-
public final class IntArrayPredicateIterator extends Object implements Iterator<Integer>
Iterates over ranges between elements for which a given predicate returnstrue. The returned range may be of zero length (getLength()).An example probably best explains what this class does. Consider the following array:
[SEP, SEP, 1, SEP]
whereSEPis something for which the predicate returnstrue. If so, then the returned subranges would be equal to (start index, length):[0,0] (empty range before the first separator) [1,0] (empty range after the first separator) [2,1] ([1]) [4,0] (empty range after last separator)
-
-
Constructor Summary
Constructors Constructor Description IntArrayPredicateIterator(short[] array, int from, int length, com.carrotsearch.hppc.predicates.ShortPredicate separator)IntArrayPredicateIterator(short[] array, com.carrotsearch.hppc.predicates.ShortPredicate separator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetLength()Returns the length (number of elements) of the range most recently acquired fromnext().booleanhasNext()Integernext()voidremove()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
IntArrayPredicateIterator
public IntArrayPredicateIterator(short[] array, int from, int length, com.carrotsearch.hppc.predicates.ShortPredicate separator)
-
IntArrayPredicateIterator
public IntArrayPredicateIterator(short[] array, com.carrotsearch.hppc.predicates.ShortPredicate separator)
-
-
Method Detail
-
getLength
public int getLength()
Returns the length (number of elements) of the range most recently acquired fromnext().
-
-