Package org.eclipse.collections.api
Interface BooleanIterable
-
- All Superinterfaces:
PrimitiveIterable
- All Known Subinterfaces:
BooleanBag
,BooleanList
,BooleanSet
,BooleanStack
,BooleanValuesMap
,ByteBooleanMap
,CharBooleanMap
,DoubleBooleanMap
,FloatBooleanMap
,ImmutableBooleanBag
,ImmutableBooleanCollection
,ImmutableBooleanList
,ImmutableBooleanSet
,ImmutableBooleanStack
,ImmutableByteBooleanMap
,ImmutableCharBooleanMap
,ImmutableDoubleBooleanMap
,ImmutableFloatBooleanMap
,ImmutableIntBooleanMap
,ImmutableLongBooleanMap
,ImmutableObjectBooleanMap<K>
,ImmutableShortBooleanMap
,IntBooleanMap
,LazyBooleanIterable
,LongBooleanMap
,MutableBooleanBag
,MutableBooleanCollection
,MutableBooleanList
,MutableBooleanSet
,MutableBooleanStack
,MutableBooleanValuesMap
,MutableByteBooleanMap
,MutableCharBooleanMap
,MutableDoubleBooleanMap
,MutableFloatBooleanMap
,MutableIntBooleanMap
,MutableLongBooleanMap
,MutableObjectBooleanMap<K>
,MutableShortBooleanMap
,ObjectBooleanMap<K>
,OrderedBooleanIterable
,ReversibleBooleanIterable
,ShortBooleanMap
- All Known Implementing Classes:
AbstractBooleanIterable
,AbstractBooleanStack
,AbstractImmutableObjectBooleanMap
,AbstractLazyBooleanIterable
,AbstractMutableBooleanValuesMap
,AbstractMutableBooleanValuesMap.AbstractBooleanValuesCollection
,AbstractSynchronizedBooleanCollection
,AbstractUnmodifiableBooleanCollection
,BooleanArrayList
,BooleanArrayStack
,BooleanHashBag
,BooleanHashSet
,ByteBooleanHashMap
,ByteBooleanHashMap.ValuesCollection
,CharBooleanHashMap
,CharBooleanHashMap.ValuesCollection
,CollectBooleanIterable
,CollectBooleanToBooleanIterable
,CollectByteToBooleanIterable
,CollectCharToBooleanIterable
,CollectDoubleToBooleanIterable
,CollectFloatToBooleanIterable
,CollectIntToBooleanIterable
,CollectLongToBooleanIterable
,CollectShortToBooleanIterable
,DoubleBooleanHashMap
,DoubleBooleanHashMap.ValuesCollection
,FloatBooleanHashMap
,FloatBooleanHashMap.ValuesCollection
,ImmutableBooleanArrayList
,ImmutableBooleanArrayStack
,ImmutableBooleanEmptyBag
,ImmutableBooleanEmptyList
,ImmutableBooleanEmptySet
,ImmutableBooleanEmptyStack
,ImmutableBooleanHashBag
,ImmutableBooleanSingletonBag
,ImmutableBooleanSingletonList
,ImmutableBooleanSingletonStack
,ImmutableByteBooleanEmptyMap
,ImmutableByteBooleanHashMap
,ImmutableByteBooleanSingletonMap
,ImmutableCharBooleanEmptyMap
,ImmutableCharBooleanHashMap
,ImmutableCharBooleanSingletonMap
,ImmutableDoubleBooleanEmptyMap
,ImmutableDoubleBooleanHashMap
,ImmutableDoubleBooleanSingletonMap
,ImmutableFalseSet
,ImmutableFloatBooleanEmptyMap
,ImmutableFloatBooleanHashMap
,ImmutableFloatBooleanSingletonMap
,ImmutableIntBooleanEmptyMap
,ImmutableIntBooleanHashMap
,ImmutableIntBooleanSingletonMap
,ImmutableLongBooleanEmptyMap
,ImmutableLongBooleanHashMap
,ImmutableLongBooleanSingletonMap
,ImmutableObjectBooleanEmptyMap
,ImmutableObjectBooleanHashMap
,ImmutableObjectBooleanSingletonMap
,ImmutableShortBooleanEmptyMap
,ImmutableShortBooleanHashMap
,ImmutableShortBooleanSingletonMap
,ImmutableTrueFalseSet
,ImmutableTrueSet
,IntBooleanHashMap
,IntBooleanHashMap.ValuesCollection
,LazyBooleanIterableAdapter
,LongBooleanHashMap
,LongBooleanHashMap.ValuesCollection
,ObjectBooleanHashMap
,ObjectBooleanHashMap.ValuesCollection
,ObjectBooleanHashMapWithHashingStrategy
,ObjectBooleanHashMapWithHashingStrategy.ValuesCollection
,ReverseBooleanIterable
,SelectBooleanIterable
,ShortBooleanHashMap
,ShortBooleanHashMap.ValuesCollection
,SynchronizedBooleanBag
,SynchronizedBooleanCollection
,SynchronizedBooleanIterable
,SynchronizedBooleanList
,SynchronizedBooleanSet
,SynchronizedBooleanStack
,SynchronizedByteBooleanMap
,SynchronizedCharBooleanMap
,SynchronizedDoubleBooleanMap
,SynchronizedFloatBooleanMap
,SynchronizedIntBooleanMap
,SynchronizedLongBooleanMap
,SynchronizedObjectBooleanMap
,SynchronizedShortBooleanMap
,TapBooleanIterable
,UnmodifiableBooleanBag
,UnmodifiableBooleanCollection
,UnmodifiableBooleanList
,UnmodifiableBooleanSet
,UnmodifiableBooleanStack
,UnmodifiableByteBooleanMap
,UnmodifiableCharBooleanMap
,UnmodifiableDoubleBooleanMap
,UnmodifiableFloatBooleanMap
,UnmodifiableIntBooleanMap
,UnmodifiableLongBooleanMap
,UnmodifiableObjectBooleanMap
,UnmodifiableShortBooleanMap
public interface BooleanIterable extends PrimitiveIterable
BooleanIterable is an interface which is memory-optimized for boolean primitives. It is inspired by the interface RichIterable, and contains a subset of the internal iterator methods on RichIterable like collect, sum, etc. The API also includes an external iterator method, which returns an BooleanIterator. BooleanIterator helps iterate over the BooleanIterable without boxing the primitives. This file was automatically generated from template file primitiveIterable.stg.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
allSatisfy(BooleanPredicate predicate)
Returns true if all of the elements in the BooleanIterable return true for the specified predicate, otherwise returns false.boolean
anySatisfy(BooleanPredicate predicate)
Returns true if any of the elements in the BooleanIterable return true for the specified predicate, otherwise returns false.LazyBooleanIterable
asLazy()
Returns a LazyBooleanIterable adapter wrapping the source BooleanIterable.BooleanIterator
booleanIterator()
Returns a primitive iterator that can be used to iterate over the BooleanIterable in an imperative style.default RichIterable<BooleanIterable>
chunk(int size)
Partitions elements in fixed size chunks.<V> RichIterable<V>
collect(BooleanToObjectFunction<? extends V> function)
Returns a new collection with the results of applying the specified function on each element of the source collection.default <V,R extends java.util.Collection<V>>
Rcollect(BooleanToObjectFunction<? extends V> function, R target)
Same ascollect(BooleanToObjectFunction)
, only the results are added to the target Collection.default <R extends MutableBooleanCollection>
RcollectBoolean(BooleanToBooleanFunction function, R target)
Returns the targetMutableBooleanCollection
with the results of applying the specified function on each element of the source collection.default <R extends MutableByteCollection>
RcollectByte(BooleanToByteFunction function, R target)
Returns the targetMutableByteCollection
with the results of applying the specified function on each element of the source collection.default <R extends MutableCharCollection>
RcollectChar(BooleanToCharFunction function, R target)
Returns the targetMutableCharCollection
with the results of applying the specified function on each element of the source collection.default <R extends MutableDoubleCollection>
RcollectDouble(BooleanToDoubleFunction function, R target)
Returns the targetMutableDoubleCollection
with the results of applying the specified function on each element of the source collection.default <R extends MutableFloatCollection>
RcollectFloat(BooleanToFloatFunction function, R target)
Returns the targetMutableFloatCollection
with the results of applying the specified function on each element of the source collection.default <R extends MutableIntCollection>
RcollectInt(BooleanToIntFunction function, R target)
Returns the targetMutableIntCollection
with the results of applying the specified function on each element of the source collection.default <R extends MutableLongCollection>
RcollectLong(BooleanToLongFunction function, R target)
Returns the targetMutableLongCollection
with the results of applying the specified function on each element of the source collection.default <R extends MutableShortCollection>
RcollectShort(BooleanToShortFunction function, R target)
Returns the targetMutableShortCollection
with the results of applying the specified function on each element of the source collection.boolean
contains(boolean value)
Returns true if the value is contained in the BooleanIterable, and false if it is not.default boolean
containsAll(boolean... source)
Returns true if all of the values specified in the source array are contained in the BooleanIterable, and false if they are not.default boolean
containsAll(BooleanIterable source)
Returns true if all of the values specified in the source BooleanIterable are contained in the BooleanIterable, and false if they are not.default boolean
containsAny(boolean... source)
Returns true if any of the values specified in the source array are contained in the BooleanIterable, and false if they are not.default boolean
containsAny(BooleanIterable source)
Returns true if any of the values specified in the source BooleanIterable are contained in the BooleanIterable, and false if they are not.default boolean
containsNone(boolean... source)
Returns true if none of the values specified in the source array are contained in the BooleanIterable, and false if they are.default boolean
containsNone(BooleanIterable source)
Returns true if none of the values specified in the source BooleanIterable are contained in the BooleanIterable, and false if they are.int
count(BooleanPredicate predicate)
Returns a count of the number of elements in the BooleanIterable that return true for the specified predicate.boolean
detectIfNone(BooleanPredicate predicate, boolean ifNone)
void
each(BooleanProcedure procedure)
A synonym for forEach.default <V,R extends java.util.Collection<V>>
RflatCollect(BooleanToObjectFunction<? extends java.lang.Iterable<V>> function, R target)
flatCollect
is a special case ofcollect(BooleanToObjectFunction)
.default void
forEach(BooleanProcedure procedure)
Applies the BooleanProcedure to each element in the BooleanIterable.<T> T
injectInto(T injectedValue, ObjectBooleanToObjectFunction<? super T,? extends T> function)
default boolean
injectIntoBoolean(boolean injectedValue, BooleanBooleanToBooleanFunction function)
Returns the final boolean result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.default byte
injectIntoByte(byte injectedValue, ByteBooleanToByteFunction function)
Returns the final byte result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.default char
injectIntoChar(char injectedValue, CharBooleanToCharFunction function)
Returns the final char result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.default double
injectIntoDouble(double injectedValue, DoubleBooleanToDoubleFunction function)
Returns the final double result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.default float
injectIntoFloat(float injectedValue, FloatBooleanToFloatFunction function)
Returns the final float result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.default int
injectIntoInt(int injectedValue, IntBooleanToIntFunction function)
Returns the final int result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.default long
injectIntoLong(long injectedValue, LongBooleanToLongFunction function)
Returns the final long result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.default short
injectIntoShort(short injectedValue, ShortBooleanToShortFunction function)
Returns the final short result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.default boolean
noneSatisfy(BooleanPredicate predicate)
Returns true if none of the elements in the BooleanIterable return true for the specified predicate, otherwise returns false.default boolean
reduce(BooleanBooleanToBooleanFunction accumulator)
default boolean
reduceIfEmpty(BooleanBooleanToBooleanFunction accumulator, boolean defaultValue)
BooleanIterable
reject(BooleanPredicate predicate)
Returns a new BooleanIterable with all of the elements in the BooleanIterable that return false for the specified predicate.default <R extends MutableBooleanCollection>
Rreject(BooleanPredicate predicate, R target)
Same asreject(BooleanPredicate)
, only the results are added to the target MutableBooleanCollection.BooleanIterable
select(BooleanPredicate predicate)
Returns a new BooleanIterable with all of the elements in the BooleanIterable that return true for the specified predicate.default <R extends MutableBooleanCollection>
Rselect(BooleanPredicate predicate, R target)
Same asselect(BooleanPredicate)
, only the results are added to the target MutableBooleanCollection.default BooleanIterable
tap(BooleanProcedure procedure)
boolean[]
toArray()
Converts the BooleanIterable to a primitive boolean array.default boolean[]
toArray(boolean[] target)
Converts the BooleanIterable to a primitive boolean array.MutableBooleanBag
toBag()
Converts the BooleanIterable to a new MutableBooleanBag.MutableBooleanList
toList()
Converts the BooleanIterable to a new MutableBooleanList.MutableBooleanSet
toSet()
Converts the BooleanIterable to a new MutableBooleanSet.-
Methods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, size, toString
-
-
-
-
Method Detail
-
booleanIterator
BooleanIterator booleanIterator()
Returns a primitive iterator that can be used to iterate over the BooleanIterable in an imperative style.
-
toArray
boolean[] toArray()
Converts the BooleanIterable to a primitive boolean array.
-
toArray
default boolean[] toArray(boolean[] target)
Converts the BooleanIterable to a primitive boolean array. If the collection fits into the provided array it is used to store its elements and is returned from the method, otherwise a new array of the appropriate size is allocated and returned. If the iterable is empty, the target array is returned unchanged.
-
contains
boolean contains(boolean value)
Returns true if the value is contained in the BooleanIterable, and false if it is not.
-
containsAll
default boolean containsAll(boolean... source)
Returns true if all of the values specified in the source array are contained in the BooleanIterable, and false if they are not.
-
containsAll
default boolean containsAll(BooleanIterable source)
Returns true if all of the values specified in the source BooleanIterable are contained in the BooleanIterable, and false if they are not.
-
containsAny
default boolean containsAny(boolean... source)
Returns true if any of the values specified in the source array are contained in the BooleanIterable, and false if they are not.- Since:
- 11.0
-
containsAny
default boolean containsAny(BooleanIterable source)
Returns true if any of the values specified in the source BooleanIterable are contained in the BooleanIterable, and false if they are not.- Since:
- 11.0
-
containsNone
default boolean containsNone(boolean... source)
Returns true if none of the values specified in the source array are contained in the BooleanIterable, and false if they are.- Since:
- 11.0
-
containsNone
default boolean containsNone(BooleanIterable source)
Returns true if none of the values specified in the source BooleanIterable are contained in the BooleanIterable, and false if they are.- Since:
- 11.0
-
forEach
default void forEach(BooleanProcedure procedure)
Applies the BooleanProcedure to each element in the BooleanIterable.
-
each
void each(BooleanProcedure procedure)
A synonym for forEach.- Since:
- 7.0.
-
tap
default BooleanIterable tap(BooleanProcedure procedure)
- Since:
- 9.0.
-
select
BooleanIterable select(BooleanPredicate predicate)
Returns a new BooleanIterable with all of the elements in the BooleanIterable that return true for the specified predicate.
-
reject
BooleanIterable reject(BooleanPredicate predicate)
Returns a new BooleanIterable with all of the elements in the BooleanIterable that return false for the specified predicate.
-
select
default <R extends MutableBooleanCollection> R select(BooleanPredicate predicate, R target)
Same asselect(BooleanPredicate)
, only the results are added to the target MutableBooleanCollection.- Since:
- 8.1.
-
reject
default <R extends MutableBooleanCollection> R reject(BooleanPredicate predicate, R target)
Same asreject(BooleanPredicate)
, only the results are added to the target MutableBooleanCollection.- Since:
- 8.1.
-
collect
<V> RichIterable<V> collect(BooleanToObjectFunction<? extends V> function)
Returns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.
-
collect
default <V,R extends java.util.Collection<V>> R collect(BooleanToObjectFunction<? extends V> function, R target)
Same ascollect(BooleanToObjectFunction)
, only the results are added to the target Collection.- Since:
- 8.1.
-
flatCollect
default <V,R extends java.util.Collection<V>> R flatCollect(BooleanToObjectFunction<? extends java.lang.Iterable<V>> function, R target)
flatCollect
is a special case ofcollect(BooleanToObjectFunction)
. Withcollect
, when theBooleanToObjectFunction
returns a collection, the result is a collection of collections.flatCollect
outputs a single "flattened" collection instead. This method is commonly called flatMap.- Since:
- 8.1.
-
collectBoolean
default <R extends MutableBooleanCollection> R collectBoolean(BooleanToBooleanFunction function, R target)
Returns the targetMutableBooleanCollection
with the results of applying the specified function on each element of the source collection.- Since:
- 8.1.
-
collectByte
default <R extends MutableByteCollection> R collectByte(BooleanToByteFunction function, R target)
Returns the targetMutableByteCollection
with the results of applying the specified function on each element of the source collection.- Since:
- 8.1.
-
collectChar
default <R extends MutableCharCollection> R collectChar(BooleanToCharFunction function, R target)
Returns the targetMutableCharCollection
with the results of applying the specified function on each element of the source collection.- Since:
- 8.1.
-
collectShort
default <R extends MutableShortCollection> R collectShort(BooleanToShortFunction function, R target)
Returns the targetMutableShortCollection
with the results of applying the specified function on each element of the source collection.- Since:
- 8.1.
-
collectInt
default <R extends MutableIntCollection> R collectInt(BooleanToIntFunction function, R target)
Returns the targetMutableIntCollection
with the results of applying the specified function on each element of the source collection.- Since:
- 8.1.
-
collectFloat
default <R extends MutableFloatCollection> R collectFloat(BooleanToFloatFunction function, R target)
Returns the targetMutableFloatCollection
with the results of applying the specified function on each element of the source collection.- Since:
- 8.1.
-
collectLong
default <R extends MutableLongCollection> R collectLong(BooleanToLongFunction function, R target)
Returns the targetMutableLongCollection
with the results of applying the specified function on each element of the source collection.- Since:
- 8.1.
-
collectDouble
default <R extends MutableDoubleCollection> R collectDouble(BooleanToDoubleFunction function, R target)
Returns the targetMutableDoubleCollection
with the results of applying the specified function on each element of the source collection.- Since:
- 8.1.
-
detectIfNone
boolean detectIfNone(BooleanPredicate predicate, boolean ifNone)
-
count
int count(BooleanPredicate predicate)
Returns a count of the number of elements in the BooleanIterable that return true for the specified predicate.
-
anySatisfy
boolean anySatisfy(BooleanPredicate predicate)
Returns true if any of the elements in the BooleanIterable return true for the specified predicate, otherwise returns false.
-
allSatisfy
boolean allSatisfy(BooleanPredicate predicate)
Returns true if all of the elements in the BooleanIterable return true for the specified predicate, otherwise returns false.
-
noneSatisfy
default boolean noneSatisfy(BooleanPredicate predicate)
Returns true if none of the elements in the BooleanIterable return true for the specified predicate, otherwise returns false.
-
toList
MutableBooleanList toList()
Converts the BooleanIterable to a new MutableBooleanList.
-
toSet
MutableBooleanSet toSet()
Converts the BooleanIterable to a new MutableBooleanSet.
-
toBag
MutableBooleanBag toBag()
Converts the BooleanIterable to a new MutableBooleanBag.
-
asLazy
LazyBooleanIterable asLazy()
Returns a LazyBooleanIterable adapter wrapping the source BooleanIterable.
-
injectInto
<T> T injectInto(T injectedValue, ObjectBooleanToObjectFunction<? super T,? extends T> function)
-
injectIntoBoolean
default boolean injectIntoBoolean(boolean injectedValue, BooleanBooleanToBooleanFunction function)
Returns the final boolean 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.- Since:
- 11.1
-
injectIntoByte
default byte injectIntoByte(byte injectedValue, ByteBooleanToByteFunction function)
Returns the final byte 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.- Since:
- 11.1
-
injectIntoChar
default char injectIntoChar(char injectedValue, CharBooleanToCharFunction function)
Returns the final char 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.- Since:
- 11.1
-
injectIntoShort
default short injectIntoShort(short injectedValue, ShortBooleanToShortFunction function)
Returns the final short 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.- Since:
- 11.1
-
injectIntoInt
default int injectIntoInt(int injectedValue, IntBooleanToIntFunction function)
Returns 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.- Since:
- 11.1
-
injectIntoFloat
default float injectIntoFloat(float injectedValue, FloatBooleanToFloatFunction function)
Returns the final float 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.- Since:
- 11.1
-
injectIntoLong
default long injectIntoLong(long injectedValue, LongBooleanToLongFunction function)
Returns 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.- Since:
- 11.1
-
injectIntoDouble
default double injectIntoDouble(double injectedValue, DoubleBooleanToDoubleFunction function)
Returns 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.- Since:
- 11.1
-
reduceIfEmpty
default boolean reduceIfEmpty(BooleanBooleanToBooleanFunction accumulator, boolean defaultValue)
- Since:
- 10.0
- See Also:
reduce(BooleanBooleanToBooleanFunction)
-
reduce
default boolean reduce(BooleanBooleanToBooleanFunction accumulator)
- Since:
- 10.0
- See Also:
RichIterable.reduce(BinaryOperator)
-
chunk
default RichIterable<BooleanIterable> chunk(int size)
Partitions elements in fixed size chunks.- Parameters:
size
- the number of elements per chunk- Returns:
- A
RichIterable
containingBooleanIterable
s of sizesize
, except the last will be truncated if the elements don't divide evenly. - Since:
- 9.2
-
-