Top Description Inners Fields Constructors Methods
org.eclipse.collections.impl.list

public final Class Interval

extends AbstractLazyIterable<Integer>
implements List<Integer>, Serializable, RandomAccess
Class Inheritance
All Implemented Interfaces
java.util.RandomAccess, java.io.Serializable, java.util.List, java.util.SequencedCollection, java.util.Collection, java.lang.Iterable
Imports
java.io.IOException, .ObjectInputStream, .Serializable, java.math.BigInteger, java.util.Collection, .Iterator, .List, .ListIterator, .NoSuchElementException, .RandomAccess, java.util.concurrent.CountDownLatch, .Executor, org.eclipse.collections.api.LazyIterable, org.eclipse.collections.api.bag.MutableBag, org.eclipse.collections.api.block.function.Function, .Function2, org.eclipse.collections.api.block.function.primitive.DoubleObjectToDoubleFunction, .IntObjectToIntFunction, .LongObjectToLongFunction, org.eclipse.collections.api.block.predicate.Predicate, org.eclipse.collections.api.block.procedure.Procedure, .Procedure2, org.eclipse.collections.api.block.procedure.primitive.IntIntProcedure, .IntObjectProcedure, .IntProcedure, .ObjectIntProcedure, org.eclipse.collections.api.factory.Bags, .Lists, .Sets, org.eclipse.collections.api.list.MutableList, org.eclipse.collections.api.set.MutableSet, org.eclipse.collections.impl.block.procedure.CollectProcedure, .CollectionAddProcedure, .RejectProcedure, .SelectProcedure, org.eclipse.collections.impl.lazy.AbstractLazyIterable, org.eclipse.collections.impl.list.mutable.FastList, .MutableListIterator

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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final int
private static final long
private transient int
private final int
private final int

Constructor Summary

AccessConstructor and Description
private
Interval(int from, int to, int step)

Method Summary

Modifier and TypeMethod and Description
public boolean
add(Integer integer)

Implements java.util.List.add.

Appends the specified element to the end of this list (optional operation).

public void
add(int index, Integer element)

Implements java.util.List.add.

Inserts the specified element at the specified position in this list (optional operation).

public boolean
addAll(Collection<? extends Integer> collection)

Implements java.util.List.addAll.

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation).

public boolean
addAll(int index, Collection<? extends Integer> collection)

Implements java.util.List.addAll.

Inserts all of the elements in the specified collection into this list at the specified position (optional operation).

public <R extends Collection<Integer>> R
addAllTo(R targetCollection)

private BigInteger
bigIntegerProduct()

Returns the BigInteger result of calculating product for the range.

public Interval
by(int newStep)

This instance by method allows Interval to act as a fluent builder for itself.

private void
checkBounds(String name, int index)

public void
clear()

Implements java.util.List.clear.

Removes all of the elements from this list (optional operation).

public <T, R extends Collection<T>> R
collect(Function<? super Integer, ? extends T> function, R target)

Overrides org.eclipse.collections.impl.AbstractRichIterable.collect.

Implements org.eclipse.collections.api.RichIterable.collect.

Same as collect(Function), except that the results are gathered into the specified target collection.

public boolean
public boolean
contains(int value)

Returns true if the Interval contains the specified int value.

public boolean
containsAll(int... values)

Returns true if the Interval contains all the specified int values.

public boolean
containsNone(int... values)

Returns true if the Interval contains none of the specified int values.

public LazyIterable<Integer>
distinct()

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.distinct.

Implements org.eclipse.collections.api.LazyIterable.distinct.

Creates a deferred distinct iterable to get distinct elements from the current iterable.

public LazyIterable<Integer>
drop(int count)

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.drop.

Implements org.eclipse.collections.api.LazyIterable.drop.

Creates a deferred drop iterable for the current iterable using the specified count as the limit.

public void
each(Procedure<? super Integer> procedure)

Implements org.eclipse.collections.api.RichIterable.each.

The procedure is executed for each element in the iterable.

public boolean
equals(Object otherList)

Overrides java.lang.Object.equals.

Implements java.util.List.equals.

Compares the specified object with this list for equality.

public static Interval
evensFromTo(int from, int to)

Returns an Interval representing the even values from the value from to the value to.

private void
executeAndCountdown(Procedure<? super Integer> procedure, Executor executor, CountDownLatch latch, Integer integer)

public Number
factorial()

Returns the Number result of calculating factorial for the range.

private void
public void
forEach(IntProcedure procedure)

public void
forEach(Procedure<? super Integer> procedure, Executor executor)

This method executes a void procedure against an executor, passing the current index of the interval.

public void
forEach(Procedure<? super Integer> procedure, int startIndex, int endIndex)

public <P> void
forEachWith(IntObjectProcedure<? super P> procedure, P parameter)

public <P> void
forEachWith(Procedure2<? super Integer, ? super P> procedure, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.forEachWith.

Implements org.eclipse.collections.api.InternalIterable.forEachWith.

The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.

public void
public void
forEachWithIndex(ObjectIntProcedure<? super Integer> objectIntProcedure)

Overrides org.eclipse.collections.impl.AbstractRichIterable.forEachWithIndex.

Implements org.eclipse.collections.api.InternalIterable.forEachWithIndex.

Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.

public void
forEachWithIndex(ObjectIntProcedure<? super Integer> objectIntProcedure, int startIndex, int endIndex)

public static Interval
from(int newFrom)

This static from method allows Interval to act as a fluent builder for itself.

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.

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.

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.

public Integer
get(int index)

Implements java.util.List.get.

Returns the element at the specified position in this list.

public Integer
public Integer
private boolean
public int
hashCode()

Overrides java.lang.Object.hashCode.

Implements java.util.List.hashCode.

Returns the hash code value for this list.

public int
indexOf(Object object)

Implements java.util.List.indexOf.

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

public <R> R
injectInto(R injectValue, Function2<? super R, ? super Integer, ? extends R> function)

Overrides org.eclipse.collections.impl.AbstractRichIterable.injectInto.

Implements org.eclipse.collections.api.RichIterable.injectInto.

Returns the final result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public int
injectInto(int injectedValue, IntObjectToIntFunction<? super Integer> function)

Overrides org.eclipse.collections.impl.AbstractRichIterable.injectInto.

Implements org.eclipse.collections.api.RichIterable.injectInto.

Returns the final int result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public long
injectInto(long injectedValue, LongObjectToLongFunction<? super Integer> function)

Overrides org.eclipse.collections.impl.AbstractRichIterable.injectInto.

Implements org.eclipse.collections.api.RichIterable.injectInto.

Returns the final long result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public double
injectInto(double injectedValue, DoubleObjectToDoubleFunction<? super Integer> function)

Overrides org.eclipse.collections.impl.AbstractRichIterable.injectInto.

Implements org.eclipse.collections.api.RichIterable.injectInto.

Returns the final double result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

private boolean
intObjectNotEqual(int i, Object object)

public Iterator<Integer>
iterator()

Implements java.util.List.iterator, java.lang.Iterable.iterator.

Returns an iterator over the elements in this list in proper sequence.

public int
lastIndexOf(Object object)

Implements java.util.List.lastIndexOf.

Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.

public ListIterator<Integer>
listIterator()

Implements java.util.List.listIterator.

Returns a list iterator over the elements in this list (in proper sequence).

public ListIterator<Integer>
listIterator(int index)

Implements java.util.List.listIterator.

Returns a list iterator over the elements in this list (in proper sequence), starting at the specified position in the list.

public static Interval
oddsFromTo(int from, int to)

Returns an Interval representing the odd values from the value from to the value to.

public static Interval
oneTo(int count)

Returns an Interval starting from 1 to the specified count value with a step value of 1.

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.

public Number
product()

Returns the Number result of calculating product for the range.

private void
public <R extends Collection<Integer>> R
reject(Predicate<? super Integer> predicate, R target)

Overrides org.eclipse.collections.impl.AbstractRichIterable.reject.

Implements org.eclipse.collections.api.RichIterable.reject.

Same as the reject method with one parameter but uses the specified target collection for the results.

public boolean
remove(Object o)

Implements java.util.List.remove.

Removes the first occurrence of the specified element from this list, if it is present (optional operation).

public Integer
remove(int index)

Implements java.util.List.remove.

Removes the element at the specified position in this list (optional operation).

public boolean
removeAll(Collection<?> collection)

Implements java.util.List.removeAll.

Removes from this list all of its elements that are contained in the specified collection (optional operation).

public boolean
retainAll(Collection<?> collection)

Implements java.util.List.retainAll.

Retains only the elements in this list that are contained in the specified collection (optional operation).

public void
reverseForEach(Procedure<? super Integer> procedure)

public <R> R
reverseInjectInto(R injectValue, Function2<? super R, Integer, ? extends R> function)

public Interval
reverseThis()

Returns a new interval with the from and to values reversed and the step value negated.

public void
run(Runnable runnable)

This method runs a runnable a specified number of times against on the current thread.

public void
run(Runnable runnable, Executor executor)

This method runs a runnable a specified number of times against an executor.

public <R extends Collection<Integer>> R
select(Predicate<? super Integer> predicate, R target)

Overrides org.eclipse.collections.impl.AbstractRichIterable.select.

Implements org.eclipse.collections.api.RichIterable.select.

Same as the select method with one parameter but uses the specified target collection for the results.

public Integer
set(int index, Integer element)

Implements java.util.List.set.

Replaces the element at the specified position in this list with the specified element (optional operation).

public int
public Interval
subList(int fromIndex, int toIndex)

Implements java.util.List.subList.

Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.

public LazyIterable<Integer>
take(int count)

Overrides org.eclipse.collections.impl.lazy.AbstractLazyIterable.take.

Implements org.eclipse.collections.api.LazyIterable.take.

Creates a deferred take iterable for the current iterable using the specified count as the limit.

public Interval
to(int newTo)

This instance to method allows Interval to act as a fluent builder for itself.

public static Integer[]
toArray(int from, int to)

Returns an Integer array with the values inclusively between from and to.

public Integer[]
toArray()

Overrides default org.eclipse.collections.api.LazyIterable.toArray, org.eclipse.collections.api.RichIterable.toArray.

Implements java.util.List.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element).

public <E> E[]
toArray(E[] array)

Overrides default org.eclipse.collections.api.LazyIterable.toArray, org.eclipse.collections.api.RichIterable.toArray.

Implements java.util.List.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array.

public MutableBag<Integer>
toBag()

Overrides org.eclipse.collections.impl.AbstractRichIterable.toBag.

Implements org.eclipse.collections.api.RichIterable.toBag.

Converts the collection to the default MutableBag implementation.

public int[]
toIntArray()

Converts the interval to an Integer array.

public MutableList<Integer>
toList()

Overrides org.eclipse.collections.impl.AbstractRichIterable.toList.

Implements org.eclipse.collections.api.RichIterable.toList.

Converts the collection to a MutableList implementation.

public static Integer[]
toReverseArray(int from, int to)

public static MutableList<Integer>
toReverseList(int from, int to)

Returns a MutableList representing the Integer values from the value from to the value to in reverse.

public static MutableSet<Integer>
toSet(int from, int to)

Returns a Set representing the Integer values from the value from to the value to.

public MutableSet<Integer>
toSet()

Overrides org.eclipse.collections.impl.AbstractRichIterable.toSet.

Implements org.eclipse.collections.api.RichIterable.toSet.

Converts the collection to a MutableSet implementation.

public String
toString()

Overrides org.eclipse.collections.impl.AbstractRichIterable.toString.

Implements org.eclipse.collections.api.RichIterable.toString.

Returns a string with the elements of this iterable separated by commas with spaces and enclosed in square brackets.

private int
valueAtIndex(int index)

public static Interval
zero()

Returns an Interval starting at zero.

public static Interval
zeroTo(int count)

Returns an Interval starting from 0 to the specified count value with a step value of 1.

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.

Inherited from org.eclipse.collections.impl.lazy.AbstractLazyIterable:
asLazychunkcollectcollectBooleancollectBytecollectCharcollectDoublecollectFloatcollectIfcollectIntcollectLongcollectShortcollectWithconcatenatedropWhileflatCollectgetOnlygroupBygroupByEachgroupByUniqueKeyintoisEmptymaxByOptionalmaxOptionalmaxOptionalminByOptionalminOptionalminOptionalpartitionpartitionWithrejectrejectWithselectselectInstancesOfselectWithsumByDoublesumByFloatsumByIntsumByLongtakeWhiletaptoStackzipzipWithIndex