java.io.Externalizable, java.io.Serializable, LongBag, MutableLongBag, MutableLongCollection, LongIterable, PrimitiveIterablepublic class LongHashBag extends AbstractLongIterable implements MutableLongBag, java.io.Externalizable
HashBag, and is memory-optimized for long primitives.
This file was automatically generated from template file primitiveHashBag.stg.| Constructor | Description |
|---|---|
LongHashBag() |
|
LongHashBag(int size) |
|
LongHashBag(long... elements) |
|
LongHashBag(LongIterable iterable) |
|
LongHashBag(LongHashBag bag) |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
add(long item) |
|
boolean |
addAll(long... source) |
|
boolean |
addAll(LongIterable source) |
|
void |
addOccurrences(long item,
int occurrences) |
|
boolean |
allSatisfy(LongPredicate predicate) |
Returns true if all of the elements in the LongIterable return true for the
specified predicate, otherwise returns false.
|
boolean |
anySatisfy(LongPredicate predicate) |
Returns true if any of the elements in the LongIterable return true for the
specified predicate, otherwise returns false.
|
void |
appendString(java.lang.Appendable appendable,
java.lang.String start,
java.lang.String separator,
java.lang.String end) |
Prints a string representation of this collection onto the given
Appendable. |
MutableLongBag |
asSynchronized() |
|
MutableLongBag |
asUnmodifiable() |
|
MutableList<LongIntPair> |
bottomOccurrences(int count) |
Returns the
count least frequently occurring items. |
RichIterable<LongIterable> |
chunk(int size) |
Partitions elements in fixed size chunks.
|
void |
clear() |
|
<V> MutableBag<V> |
collect(LongToObjectFunction<? extends V> function) |
Returns a new collection with the results of applying the specified function on each element of the source
collection.
|
boolean |
contains(long value) |
Returns true if the value is contained in the LongIterable, and false if it is not.
|
int |
count(LongPredicate predicate) |
Returns a count of the number of elements in the LongIterable that return true for the
specified predicate.
|
long |
detectIfNone(LongPredicate predicate,
long ifNone) |
|
void |
each(LongProcedure procedure) |
A synonym for forEach.
|
boolean |
equals(java.lang.Object otherBag) |
Follows the same general contract as
Bag.equals(Object). |
void |
forEach(LongProcedure procedure) |
Applies the LongProcedure to each element in the LongIterable.
|
void |
forEachWithOccurrences(LongIntProcedure 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,
ObjectLongToObjectFunction<? super T,? extends T> function) |
|
boolean |
isEmpty() |
Returns true if this iterable has zero items.
|
MutableLongIterator |
longIterator() |
Returns a primitive iterator that can be used to iterate over the LongIterable in an
imperative style.
|
long |
max() |
|
long |
min() |
|
static LongHashBag |
newBag(int size) |
|
static LongHashBag |
newBag(LongBag source) |
|
static LongHashBag |
newBag(LongIterable source) |
|
static LongHashBag |
newBagWith(long... source) |
|
LongHashBag |
newEmpty() |
Creates a new empty LongHashBag.
|
boolean |
noneSatisfy(LongPredicate predicate) |
Returns true if none of the elements in the LongIterable return true for the
specified predicate, otherwise returns false.
|
boolean |
notEmpty() |
The English equivalent of !this.isEmpty()
|
int |
occurrencesOf(long item) |
The occurrences of a distinct item in the bag.
|
void |
readExternal(java.io.ObjectInput in) |
|
LongHashBag |
reject(LongPredicate predicate) |
Returns a new LongIterable with all of the elements in the LongIterable that
return false for the specified predicate.
|
boolean |
remove(long item) |
|
boolean |
removeAll(long... source) |
|
boolean |
removeAll(LongIterable source) |
|
boolean |
removeIf(LongPredicate predicate) |
|
boolean |
removeOccurrences(long item,
int occurrences) |
|
boolean |
retainAll(long... source) |
|
boolean |
retainAll(LongIterable source) |
|
LongHashBag |
select(LongPredicate predicate) |
Returns a new LongIterable with all of the elements in the LongIterable that
return true for the specified predicate.
|
LongHashBag |
selectByOccurrences(IntPredicate predicate) |
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.
|
MutableLongSet |
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.
|
long |
sum() |
|
long[] |
toArray() |
Converts the LongIterable to a primitive long array.
|
ImmutableLongBag |
toImmutable() |
Returns an immutable copy of this bag.
|
MutableList<LongIntPair> |
topOccurrences(int count) |
Returns the
count most frequently occurring items. |
LongHashBag |
with(long element) |
|
LongHashBag |
with(long element1,
long element2) |
|
LongHashBag |
with(long element1,
long element2,
long element3) |
|
LongHashBag |
withAll(LongIterable iterable) |
|
LongHashBag |
without(long element) |
|
LongHashBag |
withoutAll(LongIterable iterable) |
|
void |
writeExternal(java.io.ObjectOutput out) |
asLazy, average, containsAll, containsAll, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toStringtoStringOfItemToCountasLazy, 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, toSortedListselectDuplicates, tapappendString, appendString, makeString, makeString, makeString, toStringpublic LongHashBag()
public LongHashBag(int size)
public LongHashBag(LongIterable iterable)
public LongHashBag(long... elements)
public LongHashBag(LongHashBag bag)
public static LongHashBag newBag(int size)
public static LongHashBag newBagWith(long... source)
public static LongHashBag newBag(LongIterable source)
public static LongHashBag newBag(LongBag source)
public boolean isEmpty()
PrimitiveIterableisEmpty in interface PrimitiveIterablepublic boolean notEmpty()
PrimitiveIterablenotEmpty in interface PrimitiveIterablepublic int size()
PrimitiveIterablesize in interface PrimitiveIterablepublic int sizeDistinct()
LongBagsizeDistinct in interface LongBagpublic void clear()
clear in interface MutableLongCollectionpublic LongHashBag with(long element)
with in interface MutableLongBagwith in interface MutableLongCollectionpublic LongHashBag with(long element1, long element2)
public LongHashBag with(long element1, long element2, long element3)
public LongHashBag withAll(LongIterable iterable)
withAll in interface MutableLongBagwithAll in interface MutableLongCollectionpublic LongHashBag without(long element)
without in interface MutableLongBagwithout in interface MutableLongCollectionpublic LongHashBag withoutAll(LongIterable iterable)
withoutAll in interface MutableLongBagwithoutAll in interface MutableLongCollectionpublic boolean contains(long value)
LongIterablecontains in interface LongIterablepublic int occurrencesOf(long item)
LongBagoccurrencesOf in interface LongBagpublic void forEachWithOccurrences(LongIntProcedure procedure)
LongBagforEachWithOccurrences in interface LongBagpublic LongHashBag selectByOccurrences(IntPredicate predicate)
MutableLongBagselectByOccurrences in interface LongBagselectByOccurrences in interface MutableLongBagpublic MutableLongSet selectUnique()
MutableLongBagselectUnique in interface LongBagselectUnique in interface MutableLongBagpublic MutableList<LongIntPair> topOccurrences(int count)
MutableLongBagcount 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 LongBagtopOccurrences in interface MutableLongBagpublic MutableList<LongIntPair> bottomOccurrences(int count)
MutableLongBagcount 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 LongBagbottomOccurrences in interface MutableLongBagpublic boolean add(long item)
add in interface MutableLongCollectionpublic boolean remove(long item)
remove in interface MutableLongCollectionpublic boolean removeIf(LongPredicate predicate)
removeIf in interface MutableLongCollectionpublic boolean addAll(long... source)
addAll in interface MutableLongCollectionpublic boolean addAll(LongIterable source)
addAll in interface MutableLongCollectionpublic boolean removeAll(long... source)
removeAll in interface MutableLongCollectionpublic boolean removeAll(LongIterable source)
removeAll in interface MutableLongCollectionpublic boolean retainAll(LongIterable source)
retainAll in interface MutableLongCollectionCollection.retainAll(Collection)public boolean retainAll(long... source)
retainAll in interface MutableLongCollectionCollection.retainAll(Collection)public void addOccurrences(long item,
int occurrences)
addOccurrences in interface MutableLongBagpublic boolean removeOccurrences(long item,
int occurrences)
removeOccurrences in interface MutableLongBagpublic void forEach(LongProcedure procedure)
LongIterableforEach in interface LongIterablepublic void each(LongProcedure procedure)
LongIterableeach in interface LongIterablepublic LongHashBag select(LongPredicate predicate)
LongIterableselect in interface LongBagselect in interface LongIterableselect in interface MutableLongBagselect in interface MutableLongCollectionpublic LongHashBag reject(LongPredicate predicate)
LongIterablereject in interface LongBagreject in interface LongIterablereject in interface MutableLongBagreject in interface MutableLongCollectionpublic <T> T injectInto(T injectedValue,
ObjectLongToObjectFunction<? super T,? extends T> function)
injectInto in interface LongIterablepublic RichIterable<LongIterable> chunk(int size)
LongIterablechunk in interface LongIterablesize - the number of elements per chunkRichIterable containing LongIterables of size size, except the last will be
truncated if the elements don't divide evenly.public boolean equals(java.lang.Object otherBag)
LongBagBag.equals(Object).public int hashCode()
LongBagBag.hashCode().public void appendString(java.lang.Appendable appendable,
java.lang.String start,
java.lang.String separator,
java.lang.String end)
PrimitiveIterableAppendable. Prints the string returned
by PrimitiveIterable.makeString(String, String, String).appendString in interface PrimitiveIterablepublic int count(LongPredicate predicate)
LongIterablecount in interface LongIterablepublic boolean anySatisfy(LongPredicate predicate)
LongIterableanySatisfy in interface LongIterablepublic boolean allSatisfy(LongPredicate predicate)
LongIterableallSatisfy in interface LongIterablepublic boolean noneSatisfy(LongPredicate predicate)
LongIterablenoneSatisfy in interface LongIterablepublic long detectIfNone(LongPredicate predicate, long ifNone)
detectIfNone in interface LongIterablepublic <V> MutableBag<V> collect(LongToObjectFunction<? extends V> function)
LongIterablecollect in interface LongBagcollect in interface LongIterablecollect in interface MutableLongBagcollect in interface MutableLongCollectionpublic long max()
max in interface LongIterablepublic long min()
min in interface LongIterablepublic long sum()
sum in interface LongIterablepublic long[] toArray()
LongIterabletoArray in interface LongIterablepublic MutableLongBag asUnmodifiable()
asUnmodifiable in interface MutableLongBagasUnmodifiable in interface MutableLongCollectionpublic MutableLongBag asSynchronized()
asSynchronized in interface MutableLongBagasSynchronized in interface MutableLongCollectionpublic ImmutableLongBag toImmutable()
MutableLongBagtoImmutable in interface LongBagtoImmutable in interface MutableLongBagtoImmutable in interface MutableLongCollectionpublic LongHashBag newEmpty()
newEmpty in interface MutableLongBagnewEmpty in interface MutableLongCollectionpublic MutableLongIterator longIterator()
LongIterablelongIterator in interface LongIterablelongIterator in interface MutableLongCollectionpublic void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOExceptionpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException
readExternal in interface java.io.Externalizablejava.io.IOExceptionCopyright © 2004–2020. All rights reserved.