public final class IntInterval extends Object implements ImmutableIntList, Serializable
Modifier and Type | Method and Description |
---|---|
boolean |
allSatisfy(IntPredicate predicate) |
boolean |
anySatisfy(IntPredicate predicate) |
void |
appendString(Appendable appendable)
Prints a string representation of this collection onto the given
Appendable . |
void |
appendString(Appendable appendable,
String separator)
Prints a string representation of this collection onto the given
Appendable . |
void |
appendString(Appendable appendable,
String start,
String separator,
String end)
Prints a string representation of this collection onto the given
Appendable . |
LazyIntIterable |
asLazy() |
LazyIntIterable |
asReversed() |
double |
average() |
int |
binarySearch(int value) |
IntInterval |
by(int newStep)
This instance
by method allows IntInterval to act as a fluent builder for itself. |
<V> ImmutableList<V> |
collect(IntToObjectFunction<? extends V> function) |
boolean |
contains(int value)
Returns true if the IntInterval contains the specified int value.
|
boolean |
containsAll(int... values)
Returns true if the IntInterval contains all of the specified int values.
|
boolean |
containsAll(IntIterable source) |
boolean |
containsNone(int... values)
Returns true if the IntInterval contains none of the specified int values.
|
int |
count(IntPredicate predicate) |
int |
detectIfNone(IntPredicate predicate,
int ifNone) |
ImmutableIntList |
distinct() |
long |
dotProduct(IntList list) |
void |
each(IntProcedure procedure) |
boolean |
equals(Object otherList)
Follows the same general contract as
List.equals(Object) . |
static IntInterval |
evensFromTo(int from,
int to)
Returns an IntInterval representing the even values from the value from to the value to.
|
void |
forEach(IntProcedure procedure) |
void |
forEachWithIndex(IntIntProcedure procedure) |
static IntInterval |
from(int newFrom)
This static
from method allows IntInterval to act as a fluent builder for itself. |
static IntInterval |
fromTo(int from,
int to)
Returns an IntInterval starting from the value from to the specified value to with a step value of 1.
|
static IntInterval |
fromToBy(int from,
int to,
int stepBy)
Returns an IntInterval for the range of integers inclusively between from and to with the specified
stepBy value.
|
int |
get(int index) |
int |
getFirst() |
int |
getLast() |
int |
hashCode()
Follows the same general contract as
List.hashCode() . |
int |
indexOf(int value) |
<T> T |
injectInto(T injectedValue,
ObjectIntToObjectFunction<? super T,? extends T> function) |
<T> T |
injectIntoWithIndex(T injectedValue,
ObjectIntIntToObjectFunction<? super T,? extends T> function) |
IntIterator |
intIterator() |
boolean |
isEmpty()
Returns true if this iterable has zero items.
|
int |
lastIndexOf(int value) |
String |
makeString()
Returns a string representation of this collection by delegating to
PrimitiveIterable.makeString(String) and defaulting
the separator parameter to the characters ", " (comma and space). |
String |
makeString(String separator)
Returns a string representation of this collection by delegating to
PrimitiveIterable.makeString(String, String, String)
and defaulting the start and end parameters to "" (the empty String). |
String |
makeString(String start,
String separator,
String end)
Returns a string representation of this collection.
|
int |
max() |
int |
maxIfEmpty(int defaultValue) |
double |
median() |
int |
min() |
int |
minIfEmpty(int defaultValue) |
ImmutableIntList |
newWith(int element) |
ImmutableIntList |
newWithAll(IntIterable elements) |
ImmutableIntList |
newWithout(int element) |
ImmutableIntList |
newWithoutAll(IntIterable elements) |
boolean |
noneSatisfy(IntPredicate predicate) |
boolean |
notEmpty()
The English equivalent of !this.isEmpty()
|
static IntInterval |
oddsFromTo(int from,
int to)
Returns an IntInterval representing the odd values from the value from to the value to.
|
static IntInterval |
oneTo(int count)
Returns an IntInterval starting from 1 to the specified count value with a step value of 1.
|
static IntInterval |
oneToBy(int count,
int step)
Returns an IntInterval starting from 1 to the specified count value with a step value of step.
|
ImmutableIntList |
reject(IntPredicate predicate) |
ImmutableIntList |
select(IntPredicate predicate) |
int |
size()
Calculates and returns the size of the interval.
|
ImmutableIntList |
subList(int fromIndex,
int toIndex) |
long |
sum() |
IntInterval |
to(int newTo)
This instance
to method allows IntInterval to act as a fluent builder for itself. |
int[] |
toArray() |
MutableIntBag |
toBag() |
ImmutableIntList |
toImmutable()
Returns an immutable copy of this list.
|
MutableIntList |
toList() |
IntInterval |
toReversed()
Returns a new IntInterval with the from and to values reversed and the step value negated.
|
MutableIntSet |
toSet() |
int[] |
toSortedArray() |
MutableIntList |
toSortedList() |
String |
toString()
Returns a string representation of this PrimitiveIterable.
|
static IntInterval |
zero()
Returns an IntInterval starting at zero.
|
static IntInterval |
zeroTo(int count)
Returns an IntInterval starting from 0 to the specified count value with a step value of 1.
|
static IntInterval |
zeroToBy(int count,
int step)
Returns an IntInterval starting from 0 to the specified count value with a step value of step.
|
public static IntInterval from(int newFrom)
from
method allows IntInterval to act as a fluent builder for itself.
It works in conjunction with the instance methods to(int)
and by(int)
.
Usage Example:
IntInterval interval1 = IntInterval.from(1).to(5); // results in: 1, 2, 3, 4, 5. IntInterval interval2 = IntInterval.from(1).to(10).by(2); // results in: 1, 3, 5, 7, 9.
public IntInterval to(int newTo)
to
method allows IntInterval to act as a fluent builder for itself.
It works in conjunction with the static method from(int)
and instance method by(int)
.
Usage Example:
IntInterval interval1 = IntInterval.from(1).to(5); // results in: 1, 2, 3, 4, 5. IntInterval interval2 = IntInterval.from(1).to(10).by(2); // results in: 1, 3, 5, 7, 9.
public IntInterval by(int newStep)
by
method allows IntInterval to act as a fluent builder for itself.
It works in conjunction with the static method from(int)
and instance method to(int)
.
Usage Example:
IntInterval interval1 = IntInterval.from(1).to(5); // results in: 1, 2, 3, 4, 5. IntInterval interval2 = IntInterval.from(1).to(10).by(2); // results in: 1, 3, 5, 7, 9.
public static IntInterval zero()
Usage Example:
IntInterval interval1 = IntInterval.zero().to(5); // results in: 0, 1, 2, 3, 4, 5. IntInterval interval2 = IntInterval.zero().to(10).by(2); // results in: 0, 2, 4, 6, 8, 10.
public static IntInterval oneTo(int count)
public static IntInterval oneToBy(int count, int step)
public static IntInterval zeroTo(int count)
public static IntInterval zeroToBy(int count, int step)
public static IntInterval fromTo(int from, int to)
public static IntInterval evensFromTo(int from, int to)
public static IntInterval oddsFromTo(int from, int to)
public static IntInterval fromToBy(int from, int to, int stepBy)
public boolean containsAll(int... values)
containsAll
in interface IntIterable
public boolean containsAll(IntIterable source)
containsAll
in interface IntIterable
public boolean containsNone(int... values)
public boolean contains(int value)
contains
in interface IntIterable
public void forEachWithIndex(IntIntProcedure procedure)
forEachWithIndex
in interface OrderedIntIterable
public void forEach(IntProcedure procedure)
forEach
in interface IntIterable
public void each(IntProcedure procedure)
each
in interface IntIterable
public int count(IntPredicate predicate)
count
in interface IntIterable
public boolean anySatisfy(IntPredicate predicate)
anySatisfy
in interface IntIterable
public boolean allSatisfy(IntPredicate predicate)
allSatisfy
in interface IntIterable
public boolean noneSatisfy(IntPredicate predicate)
noneSatisfy
in interface IntIterable
public boolean equals(Object otherList)
IntList
List.equals(Object)
.public int hashCode()
IntList
List.hashCode()
.public IntInterval toReversed()
toReversed
in interface ImmutableIntList
toReversed
in interface IntList
toReversed
in interface ReversibleIntIterable
public ImmutableIntList distinct()
distinct
in interface ImmutableIntList
distinct
in interface IntList
distinct
in interface ReversibleIntIterable
public ImmutableIntList subList(int fromIndex, int toIndex)
subList
in interface ImmutableIntList
subList
in interface IntList
List#subList(int fromIndex, int toIndex)}
public int size()
size
in interface PrimitiveIterable
public long dotProduct(IntList list)
dotProduct
in interface IntList
public boolean isEmpty()
PrimitiveIterable
isEmpty
in interface PrimitiveIterable
public boolean notEmpty()
PrimitiveIterable
notEmpty
in interface PrimitiveIterable
public String makeString()
PrimitiveIterable
PrimitiveIterable.makeString(String)
and defaulting
the separator parameter to the characters ", " (comma and space).makeString
in interface PrimitiveIterable
public String makeString(String separator)
PrimitiveIterable
PrimitiveIterable.makeString(String, String, String)
and defaulting the start and end parameters to "" (the empty String).makeString
in interface PrimitiveIterable
public String makeString(String start, String separator, String end)
PrimitiveIterable
makeString
in interface PrimitiveIterable
public void appendString(Appendable appendable)
PrimitiveIterable
Appendable
. Prints the string returned
by PrimitiveIterable.makeString()
.appendString
in interface PrimitiveIterable
public void appendString(Appendable appendable, String separator)
PrimitiveIterable
Appendable
. Prints the string returned
by PrimitiveIterable.makeString(String)
.appendString
in interface PrimitiveIterable
public void appendString(Appendable appendable, String start, String separator, String end)
PrimitiveIterable
Appendable
. Prints the string returned
by PrimitiveIterable.makeString(String, String, String)
.appendString
in interface PrimitiveIterable
public int[] toArray()
toArray
in interface IntIterable
public <T> T injectInto(T injectedValue, ObjectIntToObjectFunction<? super T,? extends T> function)
injectInto
in interface IntIterable
public <T> T injectIntoWithIndex(T injectedValue, ObjectIntIntToObjectFunction<? super T,? extends T> function)
injectIntoWithIndex
in interface OrderedIntIterable
injectIntoWithIndex
in interface ReversibleIntIterable
public String toString()
PrimitiveIterable
toString
in interface PrimitiveIterable
toString
in class Object
public IntIterator intIterator()
intIterator
in interface IntIterable
public int getFirst()
getFirst
in interface OrderedIntIterable
public int getLast()
getLast
in interface ReversibleIntIterable
public int indexOf(int value)
indexOf
in interface OrderedIntIterable
public int lastIndexOf(int value)
lastIndexOf
in interface IntList
public ImmutableIntList select(IntPredicate predicate)
select
in interface ImmutableIntCollection
select
in interface IntIterable
select
in interface ImmutableIntList
select
in interface IntList
select
in interface OrderedIntIterable
select
in interface ReversibleIntIterable
public ImmutableIntList reject(IntPredicate predicate)
reject
in interface ImmutableIntCollection
reject
in interface IntIterable
reject
in interface ImmutableIntList
reject
in interface IntList
reject
in interface OrderedIntIterable
reject
in interface ReversibleIntIterable
public int detectIfNone(IntPredicate predicate, int ifNone)
detectIfNone
in interface IntIterable
public <V> ImmutableList<V> collect(IntToObjectFunction<? extends V> function)
collect
in interface ImmutableIntCollection
collect
in interface IntIterable
collect
in interface ImmutableIntList
collect
in interface IntList
collect
in interface OrderedIntIterable
collect
in interface ReversibleIntIterable
public LazyIntIterable asReversed()
asReversed
in interface ReversibleIntIterable
public long sum()
sum
in interface IntIterable
public int max()
max
in interface IntIterable
public int min()
min
in interface IntIterable
public int minIfEmpty(int defaultValue)
minIfEmpty
in interface IntIterable
public int maxIfEmpty(int defaultValue)
maxIfEmpty
in interface IntIterable
public double average()
average
in interface IntIterable
public double median()
median
in interface IntIterable
public int binarySearch(int value)
binarySearch
in interface IntList
public int[] toSortedArray()
toSortedArray
in interface IntIterable
public MutableIntList toList()
toList
in interface IntIterable
public MutableIntList toSortedList()
toSortedList
in interface IntIterable
public MutableIntSet toSet()
toSet
in interface IntIterable
public MutableIntBag toBag()
toBag
in interface IntIterable
public LazyIntIterable asLazy()
asLazy
in interface IntIterable
public ImmutableIntList toImmutable()
IntList
toImmutable
in interface IntList
public ImmutableIntList newWith(int element)
newWith
in interface ImmutableIntCollection
newWith
in interface ImmutableIntList
public ImmutableIntList newWithout(int element)
newWithout
in interface ImmutableIntCollection
newWithout
in interface ImmutableIntList
public ImmutableIntList newWithAll(IntIterable elements)
newWithAll
in interface ImmutableIntCollection
newWithAll
in interface ImmutableIntList
public ImmutableIntList newWithoutAll(IntIterable elements)
newWithoutAll
in interface ImmutableIntCollection
newWithoutAll
in interface ImmutableIntList
Copyright © 2004–2016. All rights reserved.