Class FloatHashBag
java.lang.Object
org.eclipse.collections.impl.primitive.AbstractFloatIterable
org.eclipse.collections.impl.bag.mutable.primitive.FloatHashBag
- All Implemented Interfaces:
Externalizable,Serializable,FloatBag,MutableFloatBag,MutableFloatCollection,FloatIterable,PrimitiveIterable
FloatHashBag is similar to
HashBag, and is memory-optimized for float primitives.
This file was automatically generated from template file primitiveHashBag.stg.- Since:
- 3.0.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFloatHashBag(float... elements) FloatHashBag(int size) FloatHashBag(FloatIterable iterable) FloatHashBag(FloatHashBag bag) -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(float item) booleanaddAll(float... source) booleanaddAll(FloatIterable source) voidaddOccurrences(float item, int occurrences) booleanallSatisfy(FloatPredicate predicate) Returns true if all of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.booleananySatisfy(FloatPredicate predicate) Returns true if any of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.voidappendString(Appendable appendable, String start, String separator, String end) Prints a string representation of this collection onto the givenAppendable.bottomOccurrences(int count) Returns thecountleast frequently occurring items.chunk(int size) Partitions elements in fixed size chunks.voidclear()<V> MutableBag<V>collect(FloatToObjectFunction<? extends V> function) Returns a new collection with the results of applying the specified function on each element of the source collection.booleancontains(float value) Returns true if the value is contained in the FloatIterable, and false if it is not.intcount(FloatPredicate predicate) Returns a count of the number of elements in the FloatIterable that return true for the specified predicate.floatdetectIfNone(FloatPredicate predicate, float ifNone) voideach(FloatProcedure procedure) A synonym for forEach.booleanFollows the same general contract asBag.equals(Object).Returns a primitive iterator that can be used to iterate over the FloatIterable in an imperative style.voidforEachWithOccurrences(FloatIntProcedure procedure) For each distinct item, with the number of occurrences, execute the specified procedure.inthashCode()Follows the same general contract asBag.hashCode().<T> TinjectInto(T injectedValue, ObjectFloatToObjectFunction<? super T, ? extends T> function) booleanisEmpty()Returns true if this iterable has zero items.floatmax()floatmin()static FloatHashBagnewBag(int size) static FloatHashBagstatic FloatHashBagnewBag(FloatIterable source) static FloatHashBagnewBagWith(float... source) newEmpty()Creates a new empty FloatHashBag.booleannoneSatisfy(FloatPredicate predicate) Returns true if none of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.booleannotEmpty()The English equivalent of !this.isEmpty()intoccurrencesOf(float item) The occurrences of a distinct item in the bag.voidreject(FloatPredicate predicate) Returns a new FloatIterable with all of the elements in the FloatIterable that return false for the specified predicate.booleanremove(float item) booleanremoveAll(float... source) booleanremoveAll(FloatIterable source) booleanremoveIf(FloatPredicate predicate) booleanremoveOccurrences(float item, int occurrences) booleanretainAll(float... source) booleanretainAll(FloatIterable source) select(FloatPredicate predicate) Returns a new FloatIterable with all of the elements in the FloatIterable that return true for the specified predicate.selectByOccurrences(IntPredicate predicate) Returns all elements of the bag that have a number of occurrences that satisfy the predicate.Returns all elements of the bag that have exactly one occurrence.intsize()Returns the number of items in this iterable.intThe size of the Bag when counting only distinct elements.doublesum()float[]toArray()Converts the FloatIterable to a primitive float array.float[]toArray(float[] array) Converts the FloatIterable to a primitive float array.Returns an immutable copy of this bag.topOccurrences(int count) Returns thecountmost frequently occurring items.with(float element) with(float element1, float element2) with(float element1, float element2, float element3) withAll(FloatIterable iterable) without(float element) withoutAll(FloatIterable iterable) voidMethods inherited from class org.eclipse.collections.impl.primitive.AbstractFloatIterable
asLazy, average, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toStringMethods inherited from interface org.eclipse.collections.api.bag.primitive.FloatBag
toStringOfItemToCountMethods inherited from interface org.eclipse.collections.api.FloatIterable
asLazy, average, averageIfEmpty, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAll, containsAll, containsAny, containsAny, containsNone, containsNone, flatCollect, forEach, injectIntoBoolean, injectIntoByte, injectIntoChar, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, injectIntoShort, maxIfEmpty, median, medianIfEmpty, minIfEmpty, reduce, reduceIfEmpty, reject, select, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedList, toSortedList, toSortedListBy, toSortedListByMethods inherited from interface org.eclipse.collections.api.bag.primitive.MutableFloatBag
selectDuplicates, tapMethods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, makeString, makeString, makeString, toString
-
Constructor Details
-
FloatHashBag
public FloatHashBag() -
FloatHashBag
public FloatHashBag(int size) -
FloatHashBag
-
FloatHashBag
public FloatHashBag(float... elements) -
FloatHashBag
-
-
Method Details
-
newBag
-
newBagWith
-
newBag
-
newBag
-
isEmpty
public boolean isEmpty()Description copied from interface:PrimitiveIterableReturns true if this iterable has zero items.- Specified by:
isEmptyin interfacePrimitiveIterable
-
notEmpty
public boolean notEmpty()Description copied from interface:PrimitiveIterableThe English equivalent of !this.isEmpty()- Specified by:
notEmptyin interfacePrimitiveIterable
-
size
public int size()Description copied from interface:PrimitiveIterableReturns the number of items in this iterable.- Specified by:
sizein interfacePrimitiveIterable
-
sizeDistinct
public int sizeDistinct()Description copied from interface:FloatBagThe size of the Bag when counting only distinct elements.- Specified by:
sizeDistinctin interfaceFloatBag
-
clear
public void clear()- Specified by:
clearin interfaceMutableFloatCollection
-
with
- Specified by:
within interfaceMutableFloatBag- Specified by:
within interfaceMutableFloatCollection
-
with
-
with
-
withAll
- Specified by:
withAllin interfaceMutableFloatBag- Specified by:
withAllin interfaceMutableFloatCollection
-
without
- Specified by:
withoutin interfaceMutableFloatBag- Specified by:
withoutin interfaceMutableFloatCollection
-
withoutAll
- Specified by:
withoutAllin interfaceMutableFloatBag- Specified by:
withoutAllin interfaceMutableFloatCollection
-
contains
public boolean contains(float value) Description copied from interface:FloatIterableReturns true if the value is contained in the FloatIterable, and false if it is not.- Specified by:
containsin interfaceFloatIterable
-
occurrencesOf
public int occurrencesOf(float item) Description copied from interface:FloatBagThe occurrences of a distinct item in the bag.- Specified by:
occurrencesOfin interfaceFloatBag
-
forEachWithOccurrences
Description copied from interface:FloatBagFor each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrencesin interfaceFloatBag
-
selectByOccurrences
Description copied from interface:MutableFloatBagReturns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrencesin interfaceFloatBag- Specified by:
selectByOccurrencesin interfaceMutableFloatBag
-
selectUnique
Description copied from interface:MutableFloatBagReturns all elements of the bag that have exactly one occurrence.- Specified by:
selectUniquein interfaceFloatBag- Specified by:
selectUniquein interfaceMutableFloatBag
-
topOccurrences
Description copied from interface:MutableFloatBagReturns thecountmost frequently occurring items. In the event of a tie, all of the items with the number of occurrences that match the occurrences of the last item will be returned.- Specified by:
topOccurrencesin interfaceFloatBag- Specified by:
topOccurrencesin interfaceMutableFloatBag
-
bottomOccurrences
Description copied from interface:MutableFloatBagReturns thecountleast frequently occurring items. In the event of a tie, all of the items with the number of occurrences that match the occurrences of the last item will be returned.- Specified by:
bottomOccurrencesin interfaceFloatBag- Specified by:
bottomOccurrencesin interfaceMutableFloatBag
-
add
public boolean add(float item) - Specified by:
addin interfaceMutableFloatCollection
-
remove
public boolean remove(float item) - Specified by:
removein interfaceMutableFloatCollection
-
removeIf
- Specified by:
removeIfin interfaceMutableFloatCollection
-
addAll
public boolean addAll(float... source) - Specified by:
addAllin interfaceMutableFloatCollection
-
addAll
- Specified by:
addAllin interfaceMutableFloatCollection
-
removeAll
public boolean removeAll(float... source) - Specified by:
removeAllin interfaceMutableFloatCollection
-
removeAll
- Specified by:
removeAllin interfaceMutableFloatCollection
-
retainAll
- Specified by:
retainAllin interfaceMutableFloatCollection- See Also:
-
retainAll
public boolean retainAll(float... source) - Specified by:
retainAllin interfaceMutableFloatCollection- See Also:
-
addOccurrences
public void addOccurrences(float item, int occurrences) - Specified by:
addOccurrencesin interfaceMutableFloatBag
-
removeOccurrences
public boolean removeOccurrences(float item, int occurrences) - Specified by:
removeOccurrencesin interfaceMutableFloatBag
-
each
Description copied from interface:FloatIterableA synonym for forEach.- Specified by:
eachin interfaceFloatIterable- Since:
- 7.0.
-
select
Description copied from interface:FloatIterableReturns a new FloatIterable with all of the elements in the FloatIterable that return true for the specified predicate.- Specified by:
selectin interfaceFloatBag- Specified by:
selectin interfaceFloatIterable- Specified by:
selectin interfaceMutableFloatBag- Specified by:
selectin interfaceMutableFloatCollection
-
reject
Description copied from interface:FloatIterableReturns a new FloatIterable with all of the elements in the FloatIterable that return false for the specified predicate.- Specified by:
rejectin interfaceFloatBag- Specified by:
rejectin interfaceFloatIterable- Specified by:
rejectin interfaceMutableFloatBag- Specified by:
rejectin interfaceMutableFloatCollection
-
injectInto
public <T> T injectInto(T injectedValue, ObjectFloatToObjectFunction<? super T, ? extends T> function) - Specified by:
injectIntoin interfaceFloatIterable
-
chunk
Description copied from interface:FloatIterablePartitions elements in fixed size chunks.- Specified by:
chunkin interfaceFloatIterable- Parameters:
size- the number of elements per chunk- Returns:
- A
RichIterablecontainingFloatIterables of sizesize, except the last will be truncated if the elements don't divide evenly.
-
equals
Description copied from interface:FloatBagFollows the same general contract asBag.equals(Object). -
hashCode
public int hashCode()Description copied from interface:FloatBagFollows the same general contract asBag.hashCode(). -
appendString
Description copied from interface:PrimitiveIterablePrints a string representation of this collection onto the givenAppendable. Prints the string returned byPrimitiveIterable.makeString(String, String, String).- Specified by:
appendStringin interfacePrimitiveIterable
-
count
Description copied from interface:FloatIterableReturns a count of the number of elements in the FloatIterable that return true for the specified predicate.- Specified by:
countin interfaceFloatIterable
-
anySatisfy
Description copied from interface:FloatIterableReturns true if any of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfyin interfaceFloatIterable
-
allSatisfy
Description copied from interface:FloatIterableReturns true if all of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfyin interfaceFloatIterable
-
noneSatisfy
Description copied from interface:FloatIterableReturns true if none of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.- Specified by:
noneSatisfyin interfaceFloatIterable
-
detectIfNone
- Specified by:
detectIfNonein interfaceFloatIterable
-
collect
Description copied from interface:FloatIterableReturns 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.- Specified by:
collectin interfaceFloatBag- Specified by:
collectin interfaceFloatIterable- Specified by:
collectin interfaceMutableFloatBag- Specified by:
collectin interfaceMutableFloatCollection
-
max
public float max()- Specified by:
maxin interfaceFloatIterable
-
min
public float min()- Specified by:
minin interfaceFloatIterable
-
sum
public double sum()- Specified by:
sumin interfaceFloatIterable
-
toArray
public float[] toArray()Description copied from interface:FloatIterableConverts the FloatIterable to a primitive float array.- Specified by:
toArrayin interfaceFloatIterable
-
toArray
public float[] toArray(float[] array) Description copied from interface:FloatIterableConverts the FloatIterable to a primitive float 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.- Specified by:
toArrayin interfaceFloatIterable
-
asUnmodifiable
- Specified by:
asUnmodifiablein interfaceMutableFloatBag- Specified by:
asUnmodifiablein interfaceMutableFloatCollection
-
asSynchronized
- Specified by:
asSynchronizedin interfaceMutableFloatBag- Specified by:
asSynchronizedin interfaceMutableFloatCollection
-
toImmutable
Description copied from interface:MutableFloatBagReturns an immutable copy of this bag.- Specified by:
toImmutablein interfaceFloatBag- Specified by:
toImmutablein interfaceMutableFloatBag- Specified by:
toImmutablein interfaceMutableFloatCollection
-
newEmpty
Creates a new empty FloatHashBag.- Specified by:
newEmptyin interfaceMutableFloatBag- Specified by:
newEmptyin interfaceMutableFloatCollection- Since:
- 9.2.
-
floatIterator
Description copied from interface:FloatIterableReturns a primitive iterator that can be used to iterate over the FloatIterable in an imperative style.- Specified by:
floatIteratorin interfaceFloatIterable- Specified by:
floatIteratorin interfaceMutableFloatCollection
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-