Externalizable
, Serializable
, DoubleBag
, MutableDoubleBag
, MutableDoubleCollection
, DoubleIterable
, PrimitiveIterable
public class DoubleHashBag extends AbstractDoubleIterable implements MutableDoubleBag, Externalizable
HashBag
, and is memory-optimized for double primitives.
This file was automatically generated from template file primitiveHashBag.stg.Constructor | Description |
---|---|
DoubleHashBag() |
|
DoubleHashBag(double... elements) |
|
DoubleHashBag(int size) |
|
DoubleHashBag(DoubleIterable iterable) |
|
DoubleHashBag(DoubleHashBag bag) |
Modifier and Type | Method | Description |
---|---|---|
boolean |
add(double item) |
|
boolean |
addAll(double... source) |
|
boolean |
addAll(DoubleIterable source) |
|
void |
addOccurrences(double item,
int occurrences) |
|
boolean |
allSatisfy(DoublePredicate predicate) |
Returns true if all of the elements in the DoubleIterable return true for the
specified predicate, otherwise returns false.
|
boolean |
anySatisfy(DoublePredicate predicate) |
Returns true if any of the elements in the DoubleIterable return true for the
specified predicate, otherwise returns false.
|
void |
appendString(Appendable appendable,
String start,
String separator,
String end) |
Prints a string representation of this collection onto the given
Appendable . |
MutableDoubleBag |
asSynchronized() |
|
MutableDoubleBag |
asUnmodifiable() |
|
MutableList<DoubleIntPair> |
bottomOccurrences(int count) |
Returns the
count least frequently occurring items. |
RichIterable<DoubleIterable> |
chunk(int size) |
Partitions elements in fixed size chunks.
|
void |
clear() |
|
<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.
|
boolean |
contains(double value) |
Returns true if the value is contained in the DoubleIterable, and false if it is not.
|
int |
count(DoublePredicate predicate) |
Returns a count of the number of elements in the DoubleIterable that return true for the
specified predicate.
|
double |
detectIfNone(DoublePredicate predicate,
double ifNone) |
|
MutableDoubleIterator |
doubleIterator() |
Returns a primitive iterator that can be used to iterate over the DoubleIterable in an
imperative style.
|
void |
each(DoubleProcedure procedure) |
A synonym for forEach.
|
boolean |
equals(Object otherBag) |
Follows the same general contract as
Bag.equals(Object) . |
void |
forEach(DoubleProcedure procedure) |
Applies the DoubleProcedure to each element in the DoubleIterable.
|
void |
forEachWithOccurrences(DoubleIntProcedure procedure) |
For each distinct item, with the number of occurrences, execute the specified procedure.
|
int |
hashCode() |
Follows the same general contract as
Bag.hashCode() . |
<T> T |
injectInto(T injectedValue,
ObjectDoubleToObjectFunction<? super T,? extends T> function) |
|
boolean |
isEmpty() |
Returns true if this iterable has zero items.
|
double |
max() |
|
double |
min() |
|
static DoubleHashBag |
newBag(int size) |
|
static DoubleHashBag |
newBag(DoubleBag source) |
|
static DoubleHashBag |
newBag(DoubleIterable source) |
|
static DoubleHashBag |
newBagWith(double... source) |
|
DoubleHashBag |
newEmpty() |
Creates a new empty DoubleHashBag.
|
boolean |
noneSatisfy(DoublePredicate predicate) |
Returns true if none of the elements in the DoubleIterable return true for the
specified predicate, otherwise returns false.
|
boolean |
notEmpty() |
The English equivalent of !this.isEmpty()
|
int |
occurrencesOf(double item) |
The occurrences of a distinct item in the bag.
|
void |
readExternal(ObjectInput in) |
|
DoubleHashBag |
reject(DoublePredicate predicate) |
Returns a new DoubleIterable with all of the elements in the DoubleIterable that
return false for the specified predicate.
|
boolean |
remove(double item) |
|
boolean |
removeAll(double... source) |
|
boolean |
removeAll(DoubleIterable source) |
|
boolean |
removeIf(DoublePredicate predicate) |
|
boolean |
removeOccurrences(double item,
int occurrences) |
|
boolean |
retainAll(double... source) |
|
boolean |
retainAll(DoubleIterable source) |
|
DoubleHashBag |
select(DoublePredicate predicate) |
Returns a new DoubleIterable with all of the elements in the DoubleIterable that
return true for the specified predicate.
|
DoubleHashBag |
selectByOccurrences(IntPredicate predicate) |
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.
|
MutableDoubleSet |
selectUnique() |
Returns all elements of the bag that have exactly one occurrence.
|
int |
size() |
Returns the number of items in this iterable.
|
int |
sizeDistinct() |
The size of the Bag when counting only distinct elements.
|
double |
sum() |
|
double[] |
toArray() |
Converts the DoubleIterable to a primitive double array.
|
ImmutableDoubleBag |
toImmutable() |
Returns an immutable copy of this bag.
|
MutableList<DoubleIntPair> |
topOccurrences(int count) |
Returns the
count most frequently occurring items. |
DoubleHashBag |
with(double element) |
|
DoubleHashBag |
with(double element1,
double element2) |
|
DoubleHashBag |
with(double element1,
double element2,
double element3) |
|
DoubleHashBag |
withAll(DoubleIterable iterable) |
|
DoubleHashBag |
without(double element) |
|
DoubleHashBag |
withoutAll(DoubleIterable iterable) |
|
void |
writeExternal(ObjectOutput out) |
asLazy, average, containsAll, containsAll, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toString
toStringOfItemToCount
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, toSortedList
selectDuplicates, tap
appendString, appendString, makeString, makeString, makeString, toString
public DoubleHashBag()
public DoubleHashBag(int size)
public DoubleHashBag(DoubleIterable iterable)
public DoubleHashBag(double... elements)
public DoubleHashBag(DoubleHashBag bag)
public static DoubleHashBag newBag(int size)
public static DoubleHashBag newBagWith(double... source)
public static DoubleHashBag newBag(DoubleIterable source)
public static DoubleHashBag newBag(DoubleBag source)
public boolean isEmpty()
PrimitiveIterable
isEmpty
in interface PrimitiveIterable
public boolean notEmpty()
PrimitiveIterable
notEmpty
in interface PrimitiveIterable
public int size()
PrimitiveIterable
size
in interface PrimitiveIterable
public int sizeDistinct()
DoubleBag
sizeDistinct
in interface DoubleBag
public void clear()
clear
in interface MutableDoubleCollection
public DoubleHashBag with(double element)
with
in interface MutableDoubleBag
with
in interface MutableDoubleCollection
public DoubleHashBag with(double element1, double element2)
public DoubleHashBag with(double element1, double element2, double element3)
public DoubleHashBag withAll(DoubleIterable iterable)
withAll
in interface MutableDoubleBag
withAll
in interface MutableDoubleCollection
public DoubleHashBag without(double element)
without
in interface MutableDoubleBag
without
in interface MutableDoubleCollection
public DoubleHashBag withoutAll(DoubleIterable iterable)
withoutAll
in interface MutableDoubleBag
withoutAll
in interface MutableDoubleCollection
public boolean contains(double value)
DoubleIterable
contains
in interface DoubleIterable
public int occurrencesOf(double item)
DoubleBag
occurrencesOf
in interface DoubleBag
public void forEachWithOccurrences(DoubleIntProcedure procedure)
DoubleBag
forEachWithOccurrences
in interface DoubleBag
public DoubleHashBag selectByOccurrences(IntPredicate predicate)
MutableDoubleBag
selectByOccurrences
in interface DoubleBag
selectByOccurrences
in interface MutableDoubleBag
public MutableDoubleSet selectUnique()
MutableDoubleBag
selectUnique
in interface DoubleBag
selectUnique
in interface MutableDoubleBag
public MutableList<DoubleIntPair> topOccurrences(int count)
MutableDoubleBag
count
most 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.topOccurrences
in interface DoubleBag
topOccurrences
in interface MutableDoubleBag
public MutableList<DoubleIntPair> bottomOccurrences(int count)
MutableDoubleBag
count
least 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.bottomOccurrences
in interface DoubleBag
bottomOccurrences
in interface MutableDoubleBag
public boolean add(double item)
add
in interface MutableDoubleCollection
public boolean remove(double item)
remove
in interface MutableDoubleCollection
public boolean removeIf(DoublePredicate predicate)
removeIf
in interface MutableDoubleCollection
public boolean addAll(double... source)
addAll
in interface MutableDoubleCollection
public boolean addAll(DoubleIterable source)
addAll
in interface MutableDoubleCollection
public boolean removeAll(double... source)
removeAll
in interface MutableDoubleCollection
public boolean removeAll(DoubleIterable source)
removeAll
in interface MutableDoubleCollection
public boolean retainAll(DoubleIterable source)
retainAll
in interface MutableDoubleCollection
Collection.retainAll(Collection)
public boolean retainAll(double... source)
retainAll
in interface MutableDoubleCollection
Collection.retainAll(Collection)
public void addOccurrences(double item, int occurrences)
addOccurrences
in interface MutableDoubleBag
public boolean removeOccurrences(double item, int occurrences)
removeOccurrences
in interface MutableDoubleBag
public void forEach(DoubleProcedure procedure)
DoubleIterable
forEach
in interface DoubleIterable
public void each(DoubleProcedure procedure)
DoubleIterable
each
in interface DoubleIterable
public DoubleHashBag select(DoublePredicate predicate)
DoubleIterable
select
in interface DoubleBag
select
in interface DoubleIterable
select
in interface MutableDoubleBag
select
in interface MutableDoubleCollection
public DoubleHashBag reject(DoublePredicate predicate)
DoubleIterable
reject
in interface DoubleBag
reject
in interface DoubleIterable
reject
in interface MutableDoubleBag
reject
in interface MutableDoubleCollection
public <T> T injectInto(T injectedValue, ObjectDoubleToObjectFunction<? super T,? extends T> function)
injectInto
in interface DoubleIterable
public RichIterable<DoubleIterable> chunk(int size)
DoubleIterable
chunk
in interface DoubleIterable
size
- the number of elements per chunkRichIterable
containing DoubleIterable
s of size size
, except the last will be
truncated if the elements don't divide evenly.public boolean equals(Object otherBag)
DoubleBag
Bag.equals(Object)
.public int hashCode()
DoubleBag
Bag.hashCode()
.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 count(DoublePredicate predicate)
DoubleIterable
count
in interface DoubleIterable
public boolean anySatisfy(DoublePredicate predicate)
DoubleIterable
anySatisfy
in interface DoubleIterable
public boolean allSatisfy(DoublePredicate predicate)
DoubleIterable
allSatisfy
in interface DoubleIterable
public boolean noneSatisfy(DoublePredicate predicate)
DoubleIterable
noneSatisfy
in interface DoubleIterable
public double detectIfNone(DoublePredicate predicate, double ifNone)
detectIfNone
in interface DoubleIterable
public <V> MutableBag<V> collect(DoubleToObjectFunction<? extends V> function)
DoubleIterable
collect
in interface DoubleBag
collect
in interface DoubleIterable
collect
in interface MutableDoubleBag
collect
in interface MutableDoubleCollection
public double max()
max
in interface DoubleIterable
public double min()
min
in interface DoubleIterable
public double sum()
sum
in interface DoubleIterable
public double[] toArray()
DoubleIterable
toArray
in interface DoubleIterable
public MutableDoubleBag asUnmodifiable()
asUnmodifiable
in interface MutableDoubleBag
asUnmodifiable
in interface MutableDoubleCollection
public MutableDoubleBag asSynchronized()
asSynchronized
in interface MutableDoubleBag
asSynchronized
in interface MutableDoubleCollection
public ImmutableDoubleBag toImmutable()
MutableDoubleBag
toImmutable
in interface DoubleBag
toImmutable
in interface MutableDoubleBag
toImmutable
in interface MutableDoubleCollection
public DoubleHashBag newEmpty()
newEmpty
in interface MutableDoubleBag
newEmpty
in interface MutableDoubleCollection
public MutableDoubleIterator doubleIterator()
DoubleIterable
doubleIterator
in interface DoubleIterable
doubleIterator
in interface MutableDoubleCollection
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException
readExternal
in interface Externalizable
IOException
Copyright © 2004–2019. All rights reserved.