Class DoubleHashBag
java.lang.Object
org.eclipse.collections.impl.primitive.AbstractDoubleIterable
org.eclipse.collections.impl.bag.mutable.primitive.DoubleHashBag
- All Implemented Interfaces:
Externalizable,Serializable,DoubleBag,MutableDoubleBag,MutableDoubleCollection,DoubleIterable,PrimitiveIterable
public class DoubleHashBag extends AbstractDoubleIterable implements MutableDoubleBag, Externalizable
DoubleHashBag is similar to
HashBag, and is memory-optimized for double primitives.
This file was automatically generated from template file primitiveHashBag.stg.- Since:
- 3.0.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description DoubleHashBag()DoubleHashBag(double... elements)DoubleHashBag(int size)DoubleHashBag(DoubleIterable iterable)DoubleHashBag(DoubleHashBag bag) -
Method Summary
Modifier and Type Method Description booleanadd(double item)booleanaddAll(double... source)booleanaddAll(DoubleIterable source)voidaddOccurrences(double item, int occurrences)booleanallSatisfy(DoublePredicate predicate)Returns true if all of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.booleananySatisfy(DoublePredicate predicate)Returns true if any of the elements in the DoubleIterable 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.MutableDoubleBagasSynchronized()MutableDoubleBagasUnmodifiable()MutableList<DoubleIntPair>bottomOccurrences(int count)Returns thecountleast frequently occurring items.RichIterable<DoubleIterable>chunk(int size)Partitions elements in fixed size chunks.voidclear()<V> MutableBag<V>collect(DoubleToObjectFunction<? extends V> function)Returns a new collection with the results of applying the specified function on each element of the source collection.booleancontains(double value)Returns true if the value is contained in the DoubleIterable, and false if it is not.intcount(DoublePredicate predicate)Returns a count of the number of elements in the DoubleIterable that return true for the specified predicate.doubledetectIfNone(DoublePredicate predicate, double ifNone)MutableDoubleIteratordoubleIterator()Returns a primitive iterator that can be used to iterate over the DoubleIterable in an imperative style.voideach(DoubleProcedure procedure)A synonym for forEach.booleanequals(Object otherBag)Follows the same general contract asBag.equals(Object).voidforEach(DoubleProcedure procedure)Applies the DoubleProcedure to each element in the DoubleIterable.voidforEachWithOccurrences(DoubleIntProcedure 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, ObjectDoubleToObjectFunction<? super T,? extends T> function)booleanisEmpty()Returns true if this iterable has zero items.doublemax()doublemin()static DoubleHashBagnewBag(int size)static DoubleHashBagnewBag(DoubleBag source)static DoubleHashBagnewBag(DoubleIterable source)static DoubleHashBagnewBagWith(double... source)DoubleHashBagnewEmpty()Creates a new empty DoubleHashBag.booleannoneSatisfy(DoublePredicate predicate)Returns true if none of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.booleannotEmpty()The English equivalent of !this.isEmpty()intoccurrencesOf(double item)The occurrences of a distinct item in the bag.voidreadExternal(ObjectInput in)DoubleHashBagreject(DoublePredicate predicate)Returns a new DoubleIterable with all of the elements in the DoubleIterable that return false for the specified predicate.booleanremove(double item)booleanremoveAll(double... source)booleanremoveAll(DoubleIterable source)booleanremoveIf(DoublePredicate predicate)booleanremoveOccurrences(double item, int occurrences)booleanretainAll(double... source)booleanretainAll(DoubleIterable source)DoubleHashBagselect(DoublePredicate predicate)Returns a new DoubleIterable with all of the elements in the DoubleIterable that return true for the specified predicate.DoubleHashBagselectByOccurrences(IntPredicate predicate)Returns all elements of the bag that have a number of occurrences that satisfy the predicate.MutableDoubleSetselectUnique()Returns all elements of the bag that have exactly one occurrence.intsize()Returns the number of items in this iterable.intsizeDistinct()The size of the Bag when counting only distinct elements.doublesum()double[]toArray()Converts the DoubleIterable to a primitive double array.double[]toArray(double[] array)Converts the DoubleIterable to a primitive double array.ImmutableDoubleBagtoImmutable()Returns an immutable copy of this bag.MutableList<DoubleIntPair>topOccurrences(int count)Returns thecountmost frequently occurring items.DoubleHashBagwith(double element)DoubleHashBagwith(double element1, double element2)DoubleHashBagwith(double element1, double element2, double element3)DoubleHashBagwithAll(DoubleIterable iterable)DoubleHashBagwithout(double element)DoubleHashBagwithoutAll(DoubleIterable iterable)voidwriteExternal(ObjectOutput out)Methods inherited from class org.eclipse.collections.impl.primitive.AbstractDoubleIterable
asLazy, average, containsAll, containsAll, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toStringMethods inherited from interface org.eclipse.collections.api.bag.primitive.DoubleBag
toStringOfItemToCountMethods inherited from interface org.eclipse.collections.api.DoubleIterable
asLazy, average, averageIfEmpty, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAll, containsAll, flatCollect, maxIfEmpty, median, medianIfEmpty, minIfEmpty, reduce, reduceIfEmpty, reject, select, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedListMethods inherited from interface org.eclipse.collections.api.bag.primitive.MutableDoubleBag
selectDuplicates, tapMethods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, makeString, makeString, makeString, toString
-
Constructor Details
-
DoubleHashBag
public DoubleHashBag() -
DoubleHashBag
public DoubleHashBag(int size) -
DoubleHashBag
-
DoubleHashBag
public DoubleHashBag(double... elements) -
DoubleHashBag
-
-
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:DoubleBagThe size of the Bag when counting only distinct elements.- Specified by:
sizeDistinctin interfaceDoubleBag
-
clear
public void clear()- Specified by:
clearin interfaceMutableDoubleCollection
-
with
- Specified by:
within interfaceMutableDoubleBag- Specified by:
within interfaceMutableDoubleCollection
-
with
-
with
-
withAll
- Specified by:
withAllin interfaceMutableDoubleBag- Specified by:
withAllin interfaceMutableDoubleCollection
-
without
- Specified by:
withoutin interfaceMutableDoubleBag- Specified by:
withoutin interfaceMutableDoubleCollection
-
withoutAll
- Specified by:
withoutAllin interfaceMutableDoubleBag- Specified by:
withoutAllin interfaceMutableDoubleCollection
-
contains
public boolean contains(double value)Description copied from interface:DoubleIterableReturns true if the value is contained in the DoubleIterable, and false if it is not.- Specified by:
containsin interfaceDoubleIterable
-
occurrencesOf
public int occurrencesOf(double item)Description copied from interface:DoubleBagThe occurrences of a distinct item in the bag.- Specified by:
occurrencesOfin interfaceDoubleBag
-
forEachWithOccurrences
Description copied from interface:DoubleBagFor each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrencesin interfaceDoubleBag
-
selectByOccurrences
Description copied from interface:MutableDoubleBagReturns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrencesin interfaceDoubleBag- Specified by:
selectByOccurrencesin interfaceMutableDoubleBag
-
selectUnique
Description copied from interface:MutableDoubleBagReturns all elements of the bag that have exactly one occurrence.- Specified by:
selectUniquein interfaceDoubleBag- Specified by:
selectUniquein interfaceMutableDoubleBag
-
topOccurrences
Description copied from interface:MutableDoubleBagReturns 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 interfaceDoubleBag- Specified by:
topOccurrencesin interfaceMutableDoubleBag
-
bottomOccurrences
Description copied from interface:MutableDoubleBagReturns 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 interfaceDoubleBag- Specified by:
bottomOccurrencesin interfaceMutableDoubleBag
-
add
public boolean add(double item)- Specified by:
addin interfaceMutableDoubleCollection
-
remove
public boolean remove(double item)- Specified by:
removein interfaceMutableDoubleCollection
-
removeIf
- Specified by:
removeIfin interfaceMutableDoubleCollection
-
addAll
public boolean addAll(double... source)- Specified by:
addAllin interfaceMutableDoubleCollection
-
addAll
- Specified by:
addAllin interfaceMutableDoubleCollection
-
removeAll
public boolean removeAll(double... source)- Specified by:
removeAllin interfaceMutableDoubleCollection
-
removeAll
- Specified by:
removeAllin interfaceMutableDoubleCollection
-
retainAll
- Specified by:
retainAllin interfaceMutableDoubleCollection- See Also:
Collection.retainAll(Collection)
-
retainAll
public boolean retainAll(double... source)- Specified by:
retainAllin interfaceMutableDoubleCollection- See Also:
Collection.retainAll(Collection)
-
addOccurrences
public void addOccurrences(double item, int occurrences)- Specified by:
addOccurrencesin interfaceMutableDoubleBag
-
removeOccurrences
public boolean removeOccurrences(double item, int occurrences)- Specified by:
removeOccurrencesin interfaceMutableDoubleBag
-
forEach
Description copied from interface:DoubleIterableApplies the DoubleProcedure to each element in the DoubleIterable.- Specified by:
forEachin interfaceDoubleIterable
-
each
Description copied from interface:DoubleIterableA synonym for forEach.- Specified by:
eachin interfaceDoubleIterable- Since:
- 7.0.
-
select
Description copied from interface:DoubleIterableReturns a new DoubleIterable with all of the elements in the DoubleIterable that return true for the specified predicate.- Specified by:
selectin interfaceDoubleBag- Specified by:
selectin interfaceDoubleIterable- Specified by:
selectin interfaceMutableDoubleBag- Specified by:
selectin interfaceMutableDoubleCollection
-
reject
Description copied from interface:DoubleIterableReturns a new DoubleIterable with all of the elements in the DoubleIterable that return false for the specified predicate.- Specified by:
rejectin interfaceDoubleBag- Specified by:
rejectin interfaceDoubleIterable- Specified by:
rejectin interfaceMutableDoubleBag- Specified by:
rejectin interfaceMutableDoubleCollection
-
injectInto
public <T> T injectInto(T injectedValue, ObjectDoubleToObjectFunction<? super T,? extends T> function)- Specified by:
injectIntoin interfaceDoubleIterable
-
chunk
Description copied from interface:DoubleIterablePartitions elements in fixed size chunks.- Specified by:
chunkin interfaceDoubleIterable- Parameters:
size- the number of elements per chunk- Returns:
- A
RichIterablecontainingDoubleIterables of sizesize, except the last will be truncated if the elements don't divide evenly.
-
equals
Description copied from interface:DoubleBagFollows the same general contract asBag.equals(Object). -
hashCode
public int hashCode()Description copied from interface:DoubleBagFollows 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:DoubleIterableReturns a count of the number of elements in the DoubleIterable that return true for the specified predicate.- Specified by:
countin interfaceDoubleIterable
-
anySatisfy
Description copied from interface:DoubleIterableReturns true if any of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfyin interfaceDoubleIterable
-
allSatisfy
Description copied from interface:DoubleIterableReturns true if all of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfyin interfaceDoubleIterable
-
noneSatisfy
Description copied from interface:DoubleIterableReturns true if none of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.- Specified by:
noneSatisfyin interfaceDoubleIterable
-
detectIfNone
- Specified by:
detectIfNonein interfaceDoubleIterable
-
collect
Description copied from interface:DoubleIterableReturns 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 interfaceDoubleBag- Specified by:
collectin interfaceDoubleIterable- Specified by:
collectin interfaceMutableDoubleBag- Specified by:
collectin interfaceMutableDoubleCollection
-
max
public double max()- Specified by:
maxin interfaceDoubleIterable
-
min
public double min()- Specified by:
minin interfaceDoubleIterable
-
sum
public double sum()- Specified by:
sumin interfaceDoubleIterable
-
toArray
public double[] toArray()Description copied from interface:DoubleIterableConverts the DoubleIterable to a primitive double array.- Specified by:
toArrayin interfaceDoubleIterable
-
toArray
public double[] toArray(double[] array)Description copied from interface:DoubleIterableConverts the DoubleIterable to a primitive double 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 interfaceDoubleIterable
-
asUnmodifiable
- Specified by:
asUnmodifiablein interfaceMutableDoubleBag- Specified by:
asUnmodifiablein interfaceMutableDoubleCollection
-
asSynchronized
- Specified by:
asSynchronizedin interfaceMutableDoubleBag- Specified by:
asSynchronizedin interfaceMutableDoubleCollection
-
toImmutable
Description copied from interface:MutableDoubleBagReturns an immutable copy of this bag.- Specified by:
toImmutablein interfaceDoubleBag- Specified by:
toImmutablein interfaceMutableDoubleBag- Specified by:
toImmutablein interfaceMutableDoubleCollection
-
newEmpty
Creates a new empty DoubleHashBag.- Specified by:
newEmptyin interfaceMutableDoubleBag- Specified by:
newEmptyin interfaceMutableDoubleCollection- Since:
- 9.2.
-
doubleIterator
Description copied from interface:DoubleIterableReturns a primitive iterator that can be used to iterate over the DoubleIterable in an imperative style.- Specified by:
doubleIteratorin interfaceDoubleIterable- Specified by:
doubleIteratorin interfaceMutableDoubleCollection
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-