Serializable
, IntIterable
, PrimitiveIterable
public class SynchronizedIntIterable extends Object implements IntIterable, Serializable
Modifier and Type | Method | Description |
---|---|---|
boolean |
allSatisfy(IntPredicate predicate) |
Returns true if all of the elements in the IntIterable return true for the
specified predicate, otherwise returns false.
|
boolean |
anySatisfy(IntPredicate predicate) |
Returns true if any of the elements in the IntIterable return true for the
specified predicate, otherwise returns false.
|
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() |
Returns a LazyIntIterable adapter wrapping the source IntIterable.
|
double |
average() |
|
RichIterable<IntIterable> |
chunk(int size) |
Partitions elements in fixed size chunks.
|
<V> RichIterable<V> |
collect(IntToObjectFunction<? extends V> function) |
Returns a new collection with the results of applying the specified function on each element of the source
collection.
|
boolean |
contains(int value) |
Returns true if the value is contained in the IntIterable, and false if it is not.
|
boolean |
containsAll(int... source) |
Returns true if the all of the values specified in the source array are contained
in the IntIterable, and false if they are not.
|
boolean |
containsAll(IntIterable source) |
Returns true if the all of the values specified in the source IntIterable are contained
in the IntIterable, and false if they are not.
|
int |
count(IntPredicate predicate) |
Returns a count of the number of elements in the IntIterable that return true for the
specified predicate.
|
int |
detectIfNone(IntPredicate predicate,
int ifNone) |
|
void |
each(IntProcedure procedure) |
A synonym for forEach.
|
void |
forEach(IntProcedure procedure) |
Applies the IntProcedure to each element in the IntIterable.
|
<T> T |
injectInto(T injectedValue,
ObjectIntToObjectFunction<? super T,? extends T> function) |
|
IntIterator |
intIterator() |
Must be called in a synchronized block.
|
boolean |
isEmpty() |
Returns true if this iterable has zero items.
|
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 with the elements separated by the specified
separator and enclosed between the start and end strings.
|
int |
max() |
|
int |
maxIfEmpty(int defaultValue) |
|
double |
median() |
|
int |
min() |
|
int |
minIfEmpty(int defaultValue) |
|
boolean |
noneSatisfy(IntPredicate predicate) |
Returns true if none of the elements in the IntIterable return true for the
specified predicate, otherwise returns false.
|
boolean |
notEmpty() |
The English equivalent of !this.isEmpty()
|
static SynchronizedIntIterable |
of(IntIterable iterable) |
This method will take a IntIterable and wrap it directly in a SynchronizedIntIterable.
|
static SynchronizedIntIterable |
of(IntIterable iterable,
Object lock) |
This method will take a IntIterable and wrap it directly in a SynchronizedIntIterable.
|
long |
reduce(LongIntToLongFunction accumulator) |
|
long |
reduceIfEmpty(LongIntToLongFunction accumulator,
long defaultValue) |
|
IntIterable |
reject(IntPredicate predicate) |
Returns a new IntIterable with all of the elements in the IntIterable that
return false for the specified predicate.
|
IntIterable |
select(IntPredicate predicate) |
Returns a new IntIterable with all of the elements in the IntIterable that
return true for the specified predicate.
|
int |
size() |
Returns the number of items in this iterable.
|
long |
sum() |
|
int[] |
toArray() |
Converts the IntIterable to a primitive int array.
|
MutableIntBag |
toBag() |
Converts the IntIterable to a new MutableIntBag.
|
MutableIntList |
toList() |
Converts the IntIterable to a new MutableIntList.
|
MutableIntSet |
toSet() |
Converts the IntIterable to a new MutableIntSet.
|
int[] |
toSortedArray() |
|
MutableIntList |
toSortedList() |
|
String |
toString() |
Returns a string with the elements of this iterable separated by commas with spaces and
enclosed in square brackets.
|
averageIfEmpty, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, flatCollect, medianIfEmpty, reject, select, summaryStatistics, tap
public static SynchronizedIntIterable of(IntIterable iterable)
public static SynchronizedIntIterable of(IntIterable iterable, Object lock)
public int[] toArray()
IntIterable
toArray
in interface IntIterable
public boolean contains(int value)
IntIterable
contains
in interface IntIterable
public boolean containsAll(int... source)
IntIterable
containsAll
in interface IntIterable
public boolean containsAll(IntIterable source)
IntIterable
containsAll
in interface IntIterable
public void forEach(IntProcedure procedure)
IntIterable
forEach
in interface IntIterable
public void each(IntProcedure procedure)
IntIterable
each
in interface IntIterable
public IntIterable select(IntPredicate predicate)
IntIterable
select
in interface IntIterable
public IntIterable reject(IntPredicate predicate)
IntIterable
reject
in interface IntIterable
public <V> RichIterable<V> collect(IntToObjectFunction<? extends V> function)
IntIterable
collect
in interface IntIterable
public int detectIfNone(IntPredicate predicate, int ifNone)
detectIfNone
in interface IntIterable
public int count(IntPredicate predicate)
IntIterable
count
in interface IntIterable
public boolean anySatisfy(IntPredicate predicate)
IntIterable
anySatisfy
in interface IntIterable
public boolean allSatisfy(IntPredicate predicate)
IntIterable
allSatisfy
in interface IntIterable
public boolean noneSatisfy(IntPredicate predicate)
IntIterable
noneSatisfy
in interface IntIterable
public MutableIntList toList()
IntIterable
toList
in interface IntIterable
public MutableIntSet toSet()
IntIterable
toSet
in interface IntIterable
public MutableIntBag toBag()
IntIterable
toBag
in interface IntIterable
public LazyIntIterable asLazy()
IntIterable
asLazy
in interface IntIterable
public long sum()
sum
in interface IntIterable
public int max()
max
in interface IntIterable
public int maxIfEmpty(int defaultValue)
maxIfEmpty
in interface IntIterable
public int min()
min
in interface IntIterable
public int minIfEmpty(int defaultValue)
minIfEmpty
in interface IntIterable
public double average()
average
in interface IntIterable
public double median()
median
in interface IntIterable
public int[] toSortedArray()
toSortedArray
in interface IntIterable
public MutableIntList toSortedList()
toSortedList
in interface IntIterable
public int size()
PrimitiveIterable
size
in interface PrimitiveIterable
public boolean isEmpty()
PrimitiveIterable
isEmpty
in interface PrimitiveIterable
public boolean notEmpty()
PrimitiveIterable
notEmpty
in interface PrimitiveIterable
public <T> T injectInto(T injectedValue, ObjectIntToObjectFunction<? super T,? extends T> function)
injectInto
in interface IntIterable
public long reduce(LongIntToLongFunction accumulator)
reduce
in interface IntIterable
RichIterable.reduce(BinaryOperator)
public long reduceIfEmpty(LongIntToLongFunction accumulator, long defaultValue)
reduceIfEmpty
in interface IntIterable
IntIterable.reduce(LongIntToLongFunction)
public RichIterable<IntIterable> chunk(int size)
IntIterable
chunk
in interface IntIterable
size
- the number of elements per chunkRichIterable
containing IntIterable
s of size size
, except the last will be
truncated if the elements don't divide evenly.public String toString()
PrimitiveIterable
Assert.assertEquals("[]", IntLists.mutable.empty().toString()); Assert.assertEquals("[1]", IntLists.mutable.with(1).toString()); Assert.assertEquals("[1, 2, 3]", IntLists.mutable.with(1, 2, 3).toString());
toString
in interface PrimitiveIterable
toString
in class Object
AbstractCollection.toString()
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 IntIterator intIterator()
intIterator
in interface IntIterable
Copyright © 2004–2019. All rights reserved.