Class Interval
- java.lang.Object
-
- org.eclipse.collections.impl.AbstractRichIterable<T>
-
- org.eclipse.collections.impl.lazy.AbstractLazyIterable<java.lang.Integer>
-
- org.eclipse.collections.impl.list.Interval
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Iterable<java.lang.Integer>,java.util.Collection<java.lang.Integer>,java.util.List<java.lang.Integer>,java.util.RandomAccess,InternalIterable<java.lang.Integer>,LazyIterable<java.lang.Integer>,RichIterable<java.lang.Integer>
public final class Interval extends AbstractLazyIterable<java.lang.Integer> implements java.util.List<java.lang.Integer>, java.io.Serializable, java.util.RandomAccess
An Interval is a range of integers that may be iterated over using a step value. Interval is an OO implementation of a for-loop.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classInterval.IntegerIterator
-
Field Summary
Fields Modifier and Type Field Description private intfromprivate static longserialVersionUIDprivate intsizeprivate intstepprivate intto
-
Constructor Summary
Constructors Modifier Constructor Description privateInterval(int from, int to, int step)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, java.lang.Integer element)booleanadd(java.lang.Integer integer)booleanaddAll(int index, java.util.Collection<? extends java.lang.Integer> collection)booleanaddAll(java.util.Collection<? extends java.lang.Integer> collection)<R extends java.util.Collection<java.lang.Integer>>
RaddAllTo(R targetCollection)private java.math.BigIntegerbigIntegerProduct()Returns the BigInteger result of calculating product for the range.Intervalby(int newStep)This instancebymethod allows Interval to act as a fluent builder for itself.private voidcheckBounds(java.lang.String name, int index)voidclear()<T,R extends java.util.Collection<T>>
Rcollect(Function<? super java.lang.Integer,? extends T> function, R target)Same asRichIterable.collect(Function), except that the results are gathered into the specifiedtargetcollection.booleancontains(int value)Returns true if the Interval contains the specified int value.booleancontains(java.lang.Object object)Returns true if the iterable has an element which responds true to element.equals(object).booleancontainsAll(int... values)Returns true if the Interval contains all the specified int values.booleancontainsNone(int... values)Returns true if the Interval contains none of the specified int values.LazyIterable<java.lang.Integer>distinct()Creates a deferred distinct iterable to get distinct elements from the current iterable.LazyIterable<java.lang.Integer>drop(int count)Creates a deferred drop iterable for the current iterable using the specified count as the limit.voideach(Procedure<? super java.lang.Integer> procedure)The procedure is executed for each element in the iterable.booleanequals(java.lang.Object otherList)static IntervalevensFromTo(int from, int to)Returns an Interval representing the even values from the value from to the value to.private voidexecuteAndCountdown(Procedure<? super java.lang.Integer> procedure, java.util.concurrent.Executor executor, java.util.concurrent.CountDownLatch latch, java.lang.Integer integer)java.lang.Numberfactorial()Returns the Number result of calculating factorial for the range.private voidfailIfOutOfFactorialRange()voidforEach(IntProcedure procedure)voidforEach(Procedure<? super java.lang.Integer> procedure, int startIndex, int endIndex)voidforEach(Procedure<? super java.lang.Integer> procedure, java.util.concurrent.Executor executor)This method executes a void procedure against an executor, passing the current index of the interval.<P> voidforEachWith(IntObjectProcedure<? super P> procedure, P parameter)<P> voidforEachWith(Procedure2<? super java.lang.Integer,? super P> procedure, P parameter)The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.voidforEachWithIndex(IntIntProcedure procedure)voidforEachWithIndex(ObjectIntProcedure<? super java.lang.Integer> objectIntProcedure)Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.voidforEachWithIndex(ObjectIntProcedure<? super java.lang.Integer> objectIntProcedure, int startIndex, int endIndex)static Intervalfrom(int newFrom)This staticfrommethod allows Interval to act as a fluent builder for itself.static IntervalfromTo(int from, int to)Returns an Interval starting from the value from to the specified value to with a step value of 1.static IntervalfromToBy(int from, int to, int stepBy)Returns an Interval for the range of integers inclusively between from and to with the specified stepBy value.static IntervalfromToExclusive(int from, int to)Returns an Interval starting from the value from until the specified value to (exclusive) with a step value of 1.java.lang.Integerget(int index)java.lang.IntegergetFirst()Returns the first element of an iterable.java.lang.IntegergetLast()Returns the last element of an iterable.private booleangoForward()inthashCode()intindexOf(java.lang.Object object)doubleinjectInto(double injectedValue, DoubleObjectToDoubleFunction<? super java.lang.Integer> function)Returns the final double result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.intinjectInto(int injectedValue, IntObjectToIntFunction<? super java.lang.Integer> function)Returns the final int result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.longinjectInto(long injectedValue, LongObjectToLongFunction<? super java.lang.Integer> function)Returns the final long result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.<R> RinjectInto(R injectValue, Function2<? super R,? super java.lang.Integer,? extends R> function)Returns the final result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.private booleanintObjectNotEqual(int i, java.lang.Object object)java.util.Iterator<java.lang.Integer>iterator()intlastIndexOf(java.lang.Object object)java.util.ListIterator<java.lang.Integer>listIterator()java.util.ListIterator<java.lang.Integer>listIterator(int index)static IntervaloddsFromTo(int from, int to)Returns an Interval representing the odd values from the value from to the value to.static IntervaloneTo(int count)Returns an Interval starting from 1 to the specified count value with a step value of 1.static IntervaloneToBy(int count, int step)Returns an Interval starting from 1 to the specified count value with a step value of step.java.lang.Numberproduct()Returns the Number result of calculating product for the range.private voidreadObject(java.io.ObjectInputStream ois)<R extends java.util.Collection<java.lang.Integer>>
Rreject(Predicate<? super java.lang.Integer> predicate, R target)Same as the reject method with one parameter but uses the specified target collection for the results.java.lang.Integerremove(int index)booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> collection)booleanretainAll(java.util.Collection<?> collection)voidreverseForEach(Procedure<? super java.lang.Integer> procedure)<R> RreverseInjectInto(R injectValue, Function2<? super R,java.lang.Integer,? extends R> function)IntervalreverseThis()Returns a new interval with the from and to values reversed and the step value negated.voidrun(java.lang.Runnable runnable)This method runs a runnable a specified number of times against on the current thread.voidrun(java.lang.Runnable runnable, java.util.concurrent.Executor executor)This method runs a runnable a specified number of times against an executor.<R extends java.util.Collection<java.lang.Integer>>
Rselect(Predicate<? super java.lang.Integer> predicate, R target)Same as the select method with one parameter but uses the specified target collection for the results.java.lang.Integerset(int index, java.lang.Integer element)intsize()Returns the size of the interval.IntervalsubList(int fromIndex, int toIndex)LazyIterable<java.lang.Integer>take(int count)Creates a deferred take iterable for the current iterable using the specified count as the limit.Intervalto(int newTo)This instancetomethod allows Interval to act as a fluent builder for itself.java.lang.Integer[]toArray()Converts this iterable to an array.static java.lang.Integer[]toArray(int from, int to)Returns an Integer array with the values inclusively between from and to.<E> E[]toArray(E[] array)Converts this iterable to an array using the specified target array, assuming the target array is as long or longer than the iterable.MutableBag<java.lang.Integer>toBag()Converts the collection to the default MutableBag implementation.int[]toIntArray()Converts the interval to an Integer array.MutableList<java.lang.Integer>toList()Converts the collection to a MutableList implementation.static java.lang.Integer[]toReverseArray(int from, int to)static MutableList<java.lang.Integer>toReverseList(int from, int to)Returns a MutableList representing the Integer values from the value from to the value to in reverse.MutableSet<java.lang.Integer>toSet()Converts the collection to a MutableSet implementation.static MutableSet<java.lang.Integer>toSet(int from, int to)Returns a Set representing the Integer values from the value from to the value to.java.lang.StringtoString()Returns a string with the elements of the iterable separated by commas with spaces and enclosed in square brackets.private intvalueAtIndex(int index)static Intervalzero()Returns an Interval starting at zero.static IntervalzeroTo(int count)Returns an Interval starting from 0 to the specified count value with a step value of 1.static IntervalzeroToBy(int count, int step)Returns an Interval starting from 0 to the specified count value with a step value of step.-
Methods inherited from class org.eclipse.collections.impl.lazy.AbstractLazyIterable
asLazy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, concatenate, dropWhile, flatCollect, getOnly, groupBy, groupByEach, groupByUniqueKey, into, isEmpty, maxByOptional, maxOptional, maxOptional, minByOptional, minOptional, minOptional, partition, partitionWith, reject, rejectWith, select, selectInstancesOf, selectWith, sumByDouble, sumByFloat, sumByInt, sumByLong, takeWhile, tap, toStack, zip, zipWithIndex
-
Methods inherited from class org.eclipse.collections.impl.AbstractRichIterable
allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, collectIf, collectWith, containsAll, containsAllArguments, containsAllIterable, count, countByEach, countWith, detect, detectOptional, detectWith, detectWithIfNone, detectWithOptional, flatCollect, forEach, groupBy, groupByEach, groupByUniqueKey, injectInto, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, rejectWith, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toBiMap, toMap, toSortedBag, toSortedBag, toSortedBagBy, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndex
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.collections.api.InternalIterable
forEach
-
Methods inherited from interface org.eclipse.collections.api.LazyIterable
flatCollectWith, toImmutableBag, toImmutableList, toImmutableSet
-
Methods inherited from interface org.eclipse.collections.api.RichIterable
aggregateBy, aggregateBy, aggregateInPlaceBy, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, containsAll, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, count, countBy, countBy, countByEach, countByEach, countByWith, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, makeString, makeString, makeString, makeString, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, notEmpty, reduce, reduceBy, reduceBy, reduceInPlace, reduceInPlace, rejectWith, selectWith, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toBiMap, toImmutableBiMap, toImmutableMap, toImmutableSortedBag, toImmutableSortedBag, toImmutableSortedBagBy, toImmutableSortedList, toImmutableSortedList, toImmutableSortedListBy, toImmutableSortedSet, toImmutableSortedSet, toImmutableSortedSetBy, toMap, toMap, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndex
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
from
private final int from
-
to
private final int to
-
step
private final int step
-
size
private transient int size
-
-
Method Detail
-
from
public static Interval from(int newFrom)
This staticfrommethod allows Interval to act as a fluent builder for itself. It works in conjunction with the instance methodsto(int)andby(int).Usage Example:
Interval interval1 = Interval.from(1).to(5); // results in: 1, 2, 3, 4, 5. Interval interval2 = Interval.from(1).to(10).by(2); // results in: 1, 3, 5, 7, 9.
-
to
public Interval to(int newTo)
This instancetomethod allows Interval to act as a fluent builder for itself. It works in conjunction with the static methodfrom(int)and instance methodby(int).Usage Example:
Interval interval1 = Interval.from(1).to(5); // results in: 1, 2, 3, 4, 5. Interval interval2 = Interval.from(1).to(10).by(2); // results in: 1, 3, 5, 7, 9.
-
by
public Interval by(int newStep)
This instancebymethod allows Interval to act as a fluent builder for itself. It works in conjunction with the static methodfrom(int)and instance methodto(int).Usage Example:
Interval interval1 = Interval.from(1).to(5); // results in: 1, 2, 3, 4, 5. Interval interval2 = Interval.from(1).to(10).by(2); // results in: 1, 3, 5, 7, 9.
-
zero
public static Interval zero()
Returns an Interval starting at zero.Usage Example:
Interval interval1 = Interval.zero().to(5); // results in: 0, 1, 2, 3, 4, 5. Interval interval2 = Interval.zero().to(10).by(2); // results in: 0, 2, 4, 6, 8, 10.
-
oneTo
public static Interval oneTo(int count)
Returns an Interval starting from 1 to the specified count value with a step value of 1.
-
oneToBy
public static Interval oneToBy(int count, int step)
Returns an Interval starting from 1 to the specified count value with a step value of step.
-
zeroTo
public static Interval zeroTo(int count)
Returns an Interval starting from 0 to the specified count value with a step value of 1.
-
zeroToBy
public static Interval zeroToBy(int count, int step)
Returns an Interval starting from 0 to the specified count value with a step value of step.
-
fromTo
public static Interval fromTo(int from, int to)
Returns an Interval starting from the value from to the specified value to with a step value of 1.
-
fromToExclusive
public static Interval fromToExclusive(int from, int to)
Returns an Interval starting from the value from until the specified value to (exclusive) with a step value of 1.
-
evensFromTo
public static Interval evensFromTo(int from, int to)
Returns an Interval representing the even values from the value from to the value to.
-
oddsFromTo
public static Interval oddsFromTo(int from, int to)
Returns an Interval representing the odd values from the value from to the value to.
-
toSet
public static MutableSet<java.lang.Integer> toSet(int from, int to)
Returns a Set representing the Integer values from the value from to the value to.
-
toReverseList
public static MutableList<java.lang.Integer> toReverseList(int from, int to)
Returns a MutableList representing the Integer values from the value from to the value to in reverse.
-
toArray
public static java.lang.Integer[] toArray(int from, int to)Returns an Integer array with the values inclusively between from and to.
-
toReverseArray
public static java.lang.Integer[] toReverseArray(int from, int to)
-
fromToBy
public static Interval fromToBy(int from, int to, int stepBy)
Returns an Interval for the range of integers inclusively between from and to with the specified stepBy value.
-
containsAll
public boolean containsAll(int... values)
Returns true if the Interval contains all the specified int values.
-
containsNone
public boolean containsNone(int... values)
Returns true if the Interval contains none of the specified int values.
-
contains
public boolean contains(java.lang.Object object)
Description copied from interface:RichIterableReturns true if the iterable has an element which responds true to element.equals(object).- Specified by:
containsin interfacejava.util.Collection<java.lang.Integer>- Specified by:
containsin interfacejava.util.List<java.lang.Integer>- Specified by:
containsin interfaceRichIterable<java.lang.Integer>- Overrides:
containsin classAbstractRichIterable<java.lang.Integer>
-
contains
public boolean contains(int value)
Returns true if the Interval contains the specified int value.
-
factorial
public java.lang.Number factorial()
Returns the Number result of calculating factorial for the range.
-
product
public java.lang.Number product()
Returns the Number result of calculating product for the range.
-
bigIntegerProduct
private java.math.BigInteger bigIntegerProduct()
Returns the BigInteger result of calculating product for the range.
-
failIfOutOfFactorialRange
private void failIfOutOfFactorialRange()
-
forEachWithIndex
public void forEachWithIndex(IntIntProcedure procedure)
-
forEachWithIndex
public void forEachWithIndex(ObjectIntProcedure<? super java.lang.Integer> objectIntProcedure)
Description copied from interface:InternalIterableIterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.Example using a Java 8 lambda:
people.forEachWithIndex((Person person, int index) -> LOGGER.info("Index: " + index + " person: " + person.getName()));Example using an anonymous inner class:
people.forEachWithIndex(new ObjectIntProcedure<Person>() { public void value(Person person, int index) { LOGGER.info("Index: " + index + " person: " + person.getName()); } });- Specified by:
forEachWithIndexin interfaceInternalIterable<java.lang.Integer>- Overrides:
forEachWithIndexin classAbstractRichIterable<java.lang.Integer>
-
forEachWith
public <P> void forEachWith(IntObjectProcedure<? super P> procedure, P parameter)
-
goForward
private boolean goForward()
-
forEachWith
public <P> void forEachWith(Procedure2<? super java.lang.Integer,? super P> procedure, P parameter)
Description copied from interface:InternalIterableThe procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.Example using a Java 8 lambda:
people.forEachWith((Person person, Person other) -> { if (person.isRelatedTo(other)) { LOGGER.info(person.getName()); } }, fred);Example using an anonymous inner class:
people.forEachWith(new Procedure2<Person, Person>() { public void value(Person person, Person other) { if (person.isRelatedTo(other)) { LOGGER.info(person.getName()); } } }, fred);- Specified by:
forEachWithin interfaceInternalIterable<java.lang.Integer>- Overrides:
forEachWithin classAbstractRichIterable<java.lang.Integer>
-
forEach
public void forEach(IntProcedure procedure)
-
each
public void each(Procedure<? super java.lang.Integer> procedure)
Description copied from interface:RichIterableThe procedure is executed for each element in the iterable.Example using a Java 8 lambda expression:
people.each(person -> LOGGER.info(person.getName()));
This method is a variant ofInternalIterable.forEach(Procedure)that has a signature conflict withIterable.forEach(java.util.function.Consumer).- Specified by:
eachin interfaceRichIterable<java.lang.Integer>- See Also:
InternalIterable.forEach(Procedure),Iterable.forEach(java.util.function.Consumer)
-
forEach
public void forEach(Procedure<? super java.lang.Integer> procedure, java.util.concurrent.Executor executor)
This method executes a void procedure against an executor, passing the current index of the interval.
-
executeAndCountdown
private void executeAndCountdown(Procedure<? super java.lang.Integer> procedure, java.util.concurrent.Executor executor, java.util.concurrent.CountDownLatch latch, java.lang.Integer integer)
-
run
public void run(java.lang.Runnable runnable)
This method runs a runnable a specified number of times against on the current thread.
-
run
public void run(java.lang.Runnable runnable, java.util.concurrent.Executor executor)This method runs a runnable a specified number of times against an executor. The method is effectively asynchronous because it does not wait for all the runnables to finish.
-
injectInto
public <R> R injectInto(R injectValue, Function2<? super R,? super java.lang.Integer,? extends R> function)Description copied from interface:RichIterableReturns the final result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter. This method is commonly called fold or sometimes reduce.- Specified by:
injectIntoin interfaceRichIterable<java.lang.Integer>- Overrides:
injectIntoin classAbstractRichIterable<java.lang.Integer>
-
injectInto
public int injectInto(int injectedValue, IntObjectToIntFunction<? super java.lang.Integer> function)Description copied from interface:RichIterableReturns the final int result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.- Specified by:
injectIntoin interfaceRichIterable<java.lang.Integer>- Overrides:
injectIntoin classAbstractRichIterable<java.lang.Integer>
-
injectInto
public long injectInto(long injectedValue, LongObjectToLongFunction<? super java.lang.Integer> function)Description copied from interface:RichIterableReturns the final long result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.- Specified by:
injectIntoin interfaceRichIterable<java.lang.Integer>- Overrides:
injectIntoin classAbstractRichIterable<java.lang.Integer>
-
injectInto
public double injectInto(double injectedValue, DoubleObjectToDoubleFunction<? super java.lang.Integer> function)Description copied from interface:RichIterableReturns the final double result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.- Specified by:
injectIntoin interfaceRichIterable<java.lang.Integer>- Overrides:
injectIntoin classAbstractRichIterable<java.lang.Integer>
-
reverseForEach
public void reverseForEach(Procedure<? super java.lang.Integer> procedure)
-
reverseInjectInto
public <R> R reverseInjectInto(R injectValue, Function2<? super R,java.lang.Integer,? extends R> function)
-
addAllTo
public <R extends java.util.Collection<java.lang.Integer>> R addAllTo(R targetCollection)
-
collect
public <T,R extends java.util.Collection<T>> R collect(Function<? super java.lang.Integer,? extends T> function, R target)
Description copied from interface:RichIterableSame asRichIterable.collect(Function), except that the results are gathered into the specifiedtargetcollection.Example using a Java 8 lambda expression:
MutableList<String> names = people.collect(person -> person.getFirstName() + " " + person.getLastName(), Lists.mutable.empty());- Specified by:
collectin interfaceRichIterable<java.lang.Integer>- Overrides:
collectin classAbstractRichIterable<java.lang.Integer>- Parameters:
function- aFunctionto use as the collect transformation functiontarget- the Collection to append to for all elements in thisRichIterablethat meet select criteriafunction- Returns:
target, which contains appended elements as a result of the collect transformation- See Also:
RichIterable.collect(Function)
-
select
public <R extends java.util.Collection<java.lang.Integer>> R select(Predicate<? super java.lang.Integer> predicate, R target)
Description copied from interface:RichIterableSame as the select method with one parameter but uses the specified target collection for the results.Example using a Java 8 lambda expression:
MutableList<Person> selected = people.select(person -> person.person.getLastName().equals("Smith"), Lists.mutable.empty());- Specified by:
selectin interfaceRichIterable<java.lang.Integer>- Overrides:
selectin classAbstractRichIterable<java.lang.Integer>- Parameters:
predicate- aPredicateto use as the select criteriatarget- the Collection to append to for all elements in thisRichIterablethat meet select criteriapredicate- Returns:
target, which contains appended elements as a result of the select criteria- See Also:
RichIterable.select(Predicate)
-
reject
public <R extends java.util.Collection<java.lang.Integer>> R reject(Predicate<? super java.lang.Integer> predicate, R target)
Description copied from interface:RichIterableSame as the reject method with one parameter but uses the specified target collection for the results.Example using a Java 8 lambda expression:
MutableList<Person> rejected = people.reject(person -> person.person.getLastName().equals("Smith"), Lists.mutable.empty());- Specified by:
rejectin interfaceRichIterable<java.lang.Integer>- Overrides:
rejectin classAbstractRichIterable<java.lang.Integer>- Parameters:
predicate- aPredicateto use as the reject criteriatarget- the Collection to append to for all elements in thisRichIterablethat causePredicate#accept(Object)method to evaluate to false- Returns:
target, which contains appended elements as a result of the reject criteria
-
equals
public boolean equals(java.lang.Object otherList)
- Specified by:
equalsin interfacejava.util.Collection<java.lang.Integer>- Specified by:
equalsin interfacejava.util.List<java.lang.Integer>- Overrides:
equalsin classjava.lang.Object
-
intObjectNotEqual
private boolean intObjectNotEqual(int i, java.lang.Object object)
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfacejava.util.Collection<java.lang.Integer>- Specified by:
hashCodein interfacejava.util.List<java.lang.Integer>- Overrides:
hashCodein classjava.lang.Object
-
reverseThis
public Interval reverseThis()
Returns a new interval with the from and to values reversed and the step value negated.
-
size
public int size()
Returns the size of the interval.- Specified by:
sizein interfacejava.util.Collection<java.lang.Integer>- Specified by:
sizein interfacejava.util.List<java.lang.Integer>- Specified by:
sizein interfaceRichIterable<java.lang.Integer>- Overrides:
sizein classAbstractLazyIterable<java.lang.Integer>
-
toArray
public java.lang.Integer[] toArray()
Description copied from interface:RichIterableConverts this iterable to an array.- Specified by:
toArrayin interfacejava.util.Collection<java.lang.Integer>- Specified by:
toArrayin interfaceLazyIterable<java.lang.Integer>- Specified by:
toArrayin interfacejava.util.List<java.lang.Integer>- Specified by:
toArrayin interfaceRichIterable<java.lang.Integer>- See Also:
Collection.toArray()
-
toArray
public <E> E[] toArray(E[] array)
Description copied from interface:RichIterableConverts this iterable to an array using the specified target array, assuming the target array is as long or longer than the iterable.- Specified by:
toArrayin interfacejava.util.Collection<java.lang.Integer>- Specified by:
toArrayin interfaceLazyIterable<java.lang.Integer>- Specified by:
toArrayin interfacejava.util.List<java.lang.Integer>- Specified by:
toArrayin interfaceRichIterable<java.lang.Integer>- See Also:
Collection.toArray(Object[])
-
toIntArray
public int[] toIntArray()
Converts the interval to an Integer array.
-
toString
public java.lang.String toString()
Description copied from class:AbstractRichIterableReturns a string with the elements of the iterable separated by commas with spaces and enclosed in square brackets.Assert.assertEquals("[]", Lists.mutable.empty().toString()); Assert.assertEquals("[1]", Lists.mutable.with(1).toString()); Assert.assertEquals("[1, 2, 3]", Lists.mutable.with(1, 2, 3).toString());- Specified by:
toStringin interfaceRichIterable<java.lang.Integer>- Overrides:
toStringin classAbstractRichIterable<java.lang.Integer>- Returns:
- a string representation of this collection.
- See Also:
AbstractCollection.toString()
-
iterator
public java.util.Iterator<java.lang.Integer> iterator()
- Specified by:
iteratorin interfacejava.util.Collection<java.lang.Integer>- Specified by:
iteratorin interfacejava.lang.Iterable<java.lang.Integer>- Specified by:
iteratorin interfacejava.util.List<java.lang.Integer>
-
getFirst
public java.lang.Integer getFirst()
Description copied from interface:RichIterableReturns the first element of an iterable. In the case of a List it is the element at the first index. In the case of any other Collection, it is the first element that would be returned during an iteration. If the iterable is empty, null is returned. If null is a valid element of the container, then a developer would need to check to see if the iterable is empty to validate that a null result was not due to the container being empty.The order of Sets are not guaranteed (except for TreeSets and other Ordered Set implementations), so if you use this method, the first element could be any element from the Set.
- Specified by:
getFirstin interfaceLazyIterable<java.lang.Integer>- Specified by:
getFirstin interfaceRichIterable<java.lang.Integer>- Overrides:
getFirstin classAbstractLazyIterable<java.lang.Integer>
-
getLast
public java.lang.Integer getLast()
Description copied from interface:RichIterableReturns the last element of an iterable. In the case of a List it is the element at the last index. In the case of any other Collection, it is the last element that would be returned during an iteration. If the iterable is empty, null is returned. If null is a valid element of the container, then a developer would need to check to see if the iterable is empty to validate that a null result was not due to the container being empty.The order of Sets are not guaranteed (except for TreeSets and other Ordered Set implementations), so if you use this method, the last element could be any element from the Set.
- Specified by:
getLastin interfaceRichIterable<java.lang.Integer>- Overrides:
getLastin classAbstractLazyIterable<java.lang.Integer>
-
forEach
public void forEach(Procedure<? super java.lang.Integer> procedure, int startIndex, int endIndex)
-
forEachWithIndex
public void forEachWithIndex(ObjectIntProcedure<? super java.lang.Integer> objectIntProcedure, int startIndex, int endIndex)
-
get
public java.lang.Integer get(int index)
- Specified by:
getin interfacejava.util.List<java.lang.Integer>
-
checkBounds
private void checkBounds(java.lang.String name, int index)
-
valueAtIndex
private int valueAtIndex(int index)
-
indexOf
public int indexOf(java.lang.Object object)
- Specified by:
indexOfin interfacejava.util.List<java.lang.Integer>
-
lastIndexOf
public int lastIndexOf(java.lang.Object object)
- Specified by:
lastIndexOfin interfacejava.util.List<java.lang.Integer>
-
toList
public MutableList<java.lang.Integer> toList()
Description copied from interface:RichIterableConverts the collection to a MutableList implementation.- Specified by:
toListin interfaceRichIterable<java.lang.Integer>- Overrides:
toListin classAbstractRichIterable<java.lang.Integer>
-
toSet
public MutableSet<java.lang.Integer> toSet()
Description copied from interface:RichIterableConverts the collection to a MutableSet implementation.- Specified by:
toSetin interfaceRichIterable<java.lang.Integer>- Overrides:
toSetin classAbstractRichIterable<java.lang.Integer>
-
toBag
public MutableBag<java.lang.Integer> toBag()
Description copied from interface:RichIterableConverts the collection to the default MutableBag implementation.- Specified by:
toBagin interfaceRichIterable<java.lang.Integer>- Overrides:
toBagin classAbstractRichIterable<java.lang.Integer>
-
add
public boolean add(java.lang.Integer integer)
- Specified by:
addin interfacejava.util.Collection<java.lang.Integer>- Specified by:
addin interfacejava.util.List<java.lang.Integer>
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
removein interfacejava.util.Collection<java.lang.Integer>- Specified by:
removein interfacejava.util.List<java.lang.Integer>
-
addAll
public boolean addAll(java.util.Collection<? extends java.lang.Integer> collection)
- Specified by:
addAllin interfacejava.util.Collection<java.lang.Integer>- Specified by:
addAllin interfacejava.util.List<java.lang.Integer>
-
addAll
public boolean addAll(int index, java.util.Collection<? extends java.lang.Integer> collection)- Specified by:
addAllin interfacejava.util.List<java.lang.Integer>
-
removeAll
public boolean removeAll(java.util.Collection<?> collection)
- Specified by:
removeAllin interfacejava.util.Collection<java.lang.Integer>- Specified by:
removeAllin interfacejava.util.List<java.lang.Integer>
-
retainAll
public boolean retainAll(java.util.Collection<?> collection)
- Specified by:
retainAllin interfacejava.util.Collection<java.lang.Integer>- Specified by:
retainAllin interfacejava.util.List<java.lang.Integer>
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Collection<java.lang.Integer>- Specified by:
clearin interfacejava.util.List<java.lang.Integer>
-
set
public java.lang.Integer set(int index, java.lang.Integer element)- Specified by:
setin interfacejava.util.List<java.lang.Integer>
-
add
public void add(int index, java.lang.Integer element)- Specified by:
addin interfacejava.util.List<java.lang.Integer>
-
remove
public java.lang.Integer remove(int index)
- Specified by:
removein interfacejava.util.List<java.lang.Integer>
-
listIterator
public java.util.ListIterator<java.lang.Integer> listIterator()
- Specified by:
listIteratorin interfacejava.util.List<java.lang.Integer>
-
listIterator
public java.util.ListIterator<java.lang.Integer> listIterator(int index)
- Specified by:
listIteratorin interfacejava.util.List<java.lang.Integer>
-
subList
public Interval subList(int fromIndex, int toIndex)
- Specified by:
subListin interfacejava.util.List<java.lang.Integer>
-
take
public LazyIterable<java.lang.Integer> take(int count)
Description copied from interface:LazyIterableCreates a deferred take iterable for the current iterable using the specified count as the limit.- Specified by:
takein interfaceLazyIterable<java.lang.Integer>- Overrides:
takein classAbstractLazyIterable<java.lang.Integer>
-
drop
public LazyIterable<java.lang.Integer> drop(int count)
Description copied from interface:LazyIterableCreates a deferred drop iterable for the current iterable using the specified count as the limit.- Specified by:
dropin interfaceLazyIterable<java.lang.Integer>- Overrides:
dropin classAbstractLazyIterable<java.lang.Integer>
-
distinct
public LazyIterable<java.lang.Integer> distinct()
Description copied from interface:LazyIterableCreates a deferred distinct iterable to get distinct elements from the current iterable.- Specified by:
distinctin interfaceLazyIterable<java.lang.Integer>- Overrides:
distinctin classAbstractLazyIterable<java.lang.Integer>
-
readObject
private void readObject(java.io.ObjectInputStream ois) throws java.io.IOException, java.lang.ClassNotFoundException- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
-