@NotThreadSafe
public final class LongHashBag
extends java.lang.Object
implements com.gs.collections.api.bag.primitive.MutableLongBag, java.io.Externalizable
HashBag, and is memory-optimized for long primitives.
This file was automatically generated from template file primitiveHashBag.stg.| Constructor and Description |
|---|
LongHashBag() |
LongHashBag(int size) |
LongHashBag(LongHashBag bag) |
LongHashBag(com.gs.collections.api.LongIterable iterable) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(long item) |
boolean |
addAll(long... source) |
boolean |
addAll(com.gs.collections.api.LongIterable source) |
void |
addOccurrences(long item,
int occurrences) |
boolean |
allSatisfy(com.gs.collections.api.block.predicate.primitive.LongPredicate predicate) |
boolean |
anySatisfy(com.gs.collections.api.block.predicate.primitive.LongPredicate predicate) |
void |
appendString(java.lang.Appendable appendable)
Prints a string representation of this collection onto the given
Appendable. |
void |
appendString(java.lang.Appendable appendable,
java.lang.String separator)
Prints a string representation of this collection onto the given
Appendable. |
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. |
com.gs.collections.api.LazyLongIterable |
asLazy() |
com.gs.collections.api.bag.primitive.MutableLongBag |
asSynchronized() |
com.gs.collections.api.bag.primitive.MutableLongBag |
asUnmodifiable() |
double |
average() |
void |
clear() |
<V> com.gs.collections.api.bag.MutableBag<V> |
collect(com.gs.collections.api.block.function.primitive.LongToObjectFunction<? extends V> function) |
boolean |
contains(long value) |
boolean |
containsAll(long... source) |
boolean |
containsAll(com.gs.collections.api.LongIterable source) |
int |
count(com.gs.collections.api.block.predicate.primitive.LongPredicate predicate) |
long |
detectIfNone(com.gs.collections.api.block.predicate.primitive.LongPredicate predicate,
long ifNone) |
boolean |
equals(java.lang.Object otherBag)
Follows the same general contract as
Bag.equals(Object). |
void |
forEach(com.gs.collections.api.block.procedure.primitive.LongProcedure procedure) |
void |
forEachWithOccurrences(com.gs.collections.api.block.procedure.primitive.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,
com.gs.collections.api.block.function.primitive.ObjectLongToObjectFunction<? super T,? extends T> function) |
boolean |
isEmpty()
Returns true if this iterable has zero items.
|
com.gs.collections.api.iterator.LongIterator |
longIterator() |
java.lang.String |
makeString()
Returns a string representation of this collection by delegating to
PrimitiveIterable.makeString(String) and defaulting
the separator parameter to the characters ", " (comma and space). |
java.lang.String |
makeString(java.lang.String separator)
Returns a string representation of this collection by delegating to
PrimitiveIterable.makeString(String, String, String)
and defaulting the start and end parameters to "" (the empty String). |
java.lang.String |
makeString(java.lang.String start,
java.lang.String separator,
java.lang.String end)
Returns a string representation of this collection.
|
long |
max() |
long |
maxIfEmpty(long defaultValue) |
double |
median() |
long |
min() |
long |
minIfEmpty(long defaultValue) |
static LongHashBag |
newBag(int size) |
static LongHashBag |
newBag(com.gs.collections.api.bag.primitive.LongBag source) |
static LongHashBag |
newBag(com.gs.collections.api.LongIterable source) |
static LongHashBag |
newBagWith(long... source) |
boolean |
noneSatisfy(com.gs.collections.api.block.predicate.primitive.LongPredicate predicate) |
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(com.gs.collections.api.block.predicate.primitive.LongPredicate predicate) |
boolean |
remove(long item) |
boolean |
removeAll(long... source) |
boolean |
removeAll(com.gs.collections.api.LongIterable source) |
boolean |
removeOccurrences(long item,
int occurrences) |
boolean |
retainAll(long... source) |
boolean |
retainAll(com.gs.collections.api.LongIterable source) |
LongHashBag |
select(com.gs.collections.api.block.predicate.primitive.LongPredicate predicate) |
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() |
com.gs.collections.api.bag.primitive.MutableLongBag |
toBag() |
com.gs.collections.api.bag.primitive.ImmutableLongBag |
toImmutable()
Returns an immutable copy of this bag.
|
com.gs.collections.api.list.primitive.MutableLongList |
toList() |
com.gs.collections.api.set.primitive.MutableLongSet |
toSet() |
long[] |
toSortedArray() |
com.gs.collections.api.list.primitive.MutableLongList |
toSortedList() |
java.lang.String |
toString()
Returns a string representation of this PrimitiveIterable.
|
LongHashBag |
with(long element) |
LongHashBag |
with(long element1,
long element2) |
LongHashBag |
with(long element1,
long element2,
long element3) |
LongHashBag |
withAll(com.gs.collections.api.LongIterable iterable) |
LongHashBag |
without(long element) |
LongHashBag |
withoutAll(com.gs.collections.api.LongIterable iterable) |
void |
writeExternal(java.io.ObjectOutput out) |
public LongHashBag()
public LongHashBag(int size)
public LongHashBag(com.gs.collections.api.LongIterable iterable)
public LongHashBag(LongHashBag bag)
public static LongHashBag newBag(int size)
public static LongHashBag newBagWith(long... source)
public static LongHashBag newBag(com.gs.collections.api.LongIterable source)
public static LongHashBag newBag(com.gs.collections.api.bag.primitive.LongBag source)
public boolean isEmpty()
com.gs.collections.api.PrimitiveIterableisEmpty in interface com.gs.collections.api.PrimitiveIterablepublic boolean notEmpty()
com.gs.collections.api.PrimitiveIterablenotEmpty in interface com.gs.collections.api.PrimitiveIterablepublic int size()
com.gs.collections.api.PrimitiveIterablesize in interface com.gs.collections.api.PrimitiveIterablepublic int sizeDistinct()
com.gs.collections.api.bag.primitive.LongBagsizeDistinct in interface com.gs.collections.api.bag.primitive.LongBagpublic void clear()
clear in interface com.gs.collections.api.collection.primitive.MutableLongCollectionpublic LongHashBag with(long element)
with in interface com.gs.collections.api.bag.primitive.MutableLongBagwith in interface com.gs.collections.api.collection.primitive.MutableLongCollectionpublic LongHashBag with(long element1, long element2)
public LongHashBag with(long element1, long element2, long element3)
public LongHashBag withAll(com.gs.collections.api.LongIterable iterable)
withAll in interface com.gs.collections.api.bag.primitive.MutableLongBagwithAll in interface com.gs.collections.api.collection.primitive.MutableLongCollectionpublic LongHashBag without(long element)
without in interface com.gs.collections.api.bag.primitive.MutableLongBagwithout in interface com.gs.collections.api.collection.primitive.MutableLongCollectionpublic LongHashBag withoutAll(com.gs.collections.api.LongIterable iterable)
withoutAll in interface com.gs.collections.api.bag.primitive.MutableLongBagwithoutAll in interface com.gs.collections.api.collection.primitive.MutableLongCollectionpublic boolean contains(long value)
contains in interface com.gs.collections.api.LongIterablepublic boolean containsAll(long... source)
containsAll in interface com.gs.collections.api.LongIterablepublic boolean containsAll(com.gs.collections.api.LongIterable source)
containsAll in interface com.gs.collections.api.LongIterablepublic int occurrencesOf(long item)
com.gs.collections.api.bag.primitive.LongBagoccurrencesOf in interface com.gs.collections.api.bag.primitive.LongBagpublic void forEachWithOccurrences(com.gs.collections.api.block.procedure.primitive.LongIntProcedure procedure)
com.gs.collections.api.bag.primitive.LongBagforEachWithOccurrences in interface com.gs.collections.api.bag.primitive.LongBagpublic boolean add(long item)
add in interface com.gs.collections.api.collection.primitive.MutableLongCollectionpublic boolean remove(long item)
remove in interface com.gs.collections.api.collection.primitive.MutableLongCollectionpublic boolean addAll(long... source)
addAll in interface com.gs.collections.api.collection.primitive.MutableLongCollectionpublic boolean addAll(com.gs.collections.api.LongIterable source)
addAll in interface com.gs.collections.api.collection.primitive.MutableLongCollectionpublic boolean removeAll(long... source)
removeAll in interface com.gs.collections.api.collection.primitive.MutableLongCollectionpublic boolean removeAll(com.gs.collections.api.LongIterable source)
removeAll in interface com.gs.collections.api.collection.primitive.MutableLongCollectionpublic boolean retainAll(com.gs.collections.api.LongIterable source)
retainAll in interface com.gs.collections.api.collection.primitive.MutableLongCollectionCollection.retainAll(Collection)public boolean retainAll(long... source)
retainAll in interface com.gs.collections.api.collection.primitive.MutableLongCollectionCollection.retainAll(Collection)public void addOccurrences(long item,
int occurrences)
addOccurrences in interface com.gs.collections.api.bag.primitive.MutableLongBagpublic boolean removeOccurrences(long item,
int occurrences)
removeOccurrences in interface com.gs.collections.api.bag.primitive.MutableLongBagpublic void forEach(com.gs.collections.api.block.procedure.primitive.LongProcedure procedure)
forEach in interface com.gs.collections.api.LongIterablepublic LongHashBag select(com.gs.collections.api.block.predicate.primitive.LongPredicate predicate)
select in interface com.gs.collections.api.bag.primitive.LongBagselect in interface com.gs.collections.api.bag.primitive.MutableLongBagselect in interface com.gs.collections.api.collection.primitive.MutableLongCollectionselect in interface com.gs.collections.api.LongIterablepublic LongHashBag reject(com.gs.collections.api.block.predicate.primitive.LongPredicate predicate)
reject in interface com.gs.collections.api.bag.primitive.LongBagreject in interface com.gs.collections.api.bag.primitive.MutableLongBagreject in interface com.gs.collections.api.collection.primitive.MutableLongCollectionreject in interface com.gs.collections.api.LongIterablepublic <T> T injectInto(T injectedValue,
com.gs.collections.api.block.function.primitive.ObjectLongToObjectFunction<? super T,? extends T> function)
injectInto in interface com.gs.collections.api.LongIterablepublic boolean equals(java.lang.Object otherBag)
com.gs.collections.api.bag.primitive.LongBagBag.equals(Object).equals in interface com.gs.collections.api.bag.primitive.LongBagequals in class java.lang.Objectpublic int hashCode()
com.gs.collections.api.bag.primitive.LongBagBag.hashCode().hashCode in interface com.gs.collections.api.bag.primitive.LongBaghashCode in class java.lang.Objectpublic java.lang.String toString()
com.gs.collections.api.PrimitiveIterabletoString in interface com.gs.collections.api.PrimitiveIterabletoString in class java.lang.Objectpublic java.lang.String makeString()
com.gs.collections.api.PrimitiveIterablePrimitiveIterable.makeString(String) and defaulting
the separator parameter to the characters ", " (comma and space).makeString in interface com.gs.collections.api.PrimitiveIterablepublic java.lang.String makeString(java.lang.String separator)
com.gs.collections.api.PrimitiveIterablePrimitiveIterable.makeString(String, String, String)
and defaulting the start and end parameters to "" (the empty String).makeString in interface com.gs.collections.api.PrimitiveIterablepublic java.lang.String makeString(java.lang.String start,
java.lang.String separator,
java.lang.String end)
com.gs.collections.api.PrimitiveIterablemakeString in interface com.gs.collections.api.PrimitiveIterablepublic void appendString(java.lang.Appendable appendable)
com.gs.collections.api.PrimitiveIterableAppendable. Prints the string returned
by PrimitiveIterable.makeString().appendString in interface com.gs.collections.api.PrimitiveIterablepublic void appendString(java.lang.Appendable appendable,
java.lang.String separator)
com.gs.collections.api.PrimitiveIterableAppendable. Prints the string returned
by PrimitiveIterable.makeString(String).appendString in interface com.gs.collections.api.PrimitiveIterablepublic void appendString(java.lang.Appendable appendable,
java.lang.String start,
java.lang.String separator,
java.lang.String end)
com.gs.collections.api.PrimitiveIterableAppendable. Prints the string returned
by PrimitiveIterable.makeString(String, String, String).appendString in interface com.gs.collections.api.PrimitiveIterablepublic int count(com.gs.collections.api.block.predicate.primitive.LongPredicate predicate)
count in interface com.gs.collections.api.LongIterablepublic boolean anySatisfy(com.gs.collections.api.block.predicate.primitive.LongPredicate predicate)
anySatisfy in interface com.gs.collections.api.LongIterablepublic boolean allSatisfy(com.gs.collections.api.block.predicate.primitive.LongPredicate predicate)
allSatisfy in interface com.gs.collections.api.LongIterablepublic boolean noneSatisfy(com.gs.collections.api.block.predicate.primitive.LongPredicate predicate)
noneSatisfy in interface com.gs.collections.api.LongIterablepublic long detectIfNone(com.gs.collections.api.block.predicate.primitive.LongPredicate predicate,
long ifNone)
detectIfNone in interface com.gs.collections.api.LongIterablepublic <V> com.gs.collections.api.bag.MutableBag<V> collect(com.gs.collections.api.block.function.primitive.LongToObjectFunction<? extends V> function)
collect in interface com.gs.collections.api.bag.primitive.LongBagcollect in interface com.gs.collections.api.bag.primitive.MutableLongBagcollect in interface com.gs.collections.api.collection.primitive.MutableLongCollectioncollect in interface com.gs.collections.api.LongIterablepublic long max()
max in interface com.gs.collections.api.LongIterablepublic long min()
min in interface com.gs.collections.api.LongIterablepublic long sum()
sum in interface com.gs.collections.api.LongIterablepublic long minIfEmpty(long defaultValue)
minIfEmpty in interface com.gs.collections.api.LongIterablepublic long maxIfEmpty(long defaultValue)
maxIfEmpty in interface com.gs.collections.api.LongIterablepublic double average()
average in interface com.gs.collections.api.LongIterablepublic double median()
median in interface com.gs.collections.api.LongIterablepublic long[] toArray()
toArray in interface com.gs.collections.api.LongIterablepublic long[] toSortedArray()
toSortedArray in interface com.gs.collections.api.LongIterablepublic com.gs.collections.api.list.primitive.MutableLongList toList()
toList in interface com.gs.collections.api.LongIterablepublic com.gs.collections.api.list.primitive.MutableLongList toSortedList()
toSortedList in interface com.gs.collections.api.LongIterablepublic com.gs.collections.api.set.primitive.MutableLongSet toSet()
toSet in interface com.gs.collections.api.LongIterablepublic com.gs.collections.api.bag.primitive.MutableLongBag toBag()
toBag in interface com.gs.collections.api.LongIterablepublic com.gs.collections.api.LazyLongIterable asLazy()
asLazy in interface com.gs.collections.api.LongIterablepublic com.gs.collections.api.bag.primitive.MutableLongBag asUnmodifiable()
asUnmodifiable in interface com.gs.collections.api.bag.primitive.MutableLongBagasUnmodifiable in interface com.gs.collections.api.collection.primitive.MutableLongCollectionpublic com.gs.collections.api.bag.primitive.MutableLongBag asSynchronized()
asSynchronized in interface com.gs.collections.api.bag.primitive.MutableLongBagasSynchronized in interface com.gs.collections.api.collection.primitive.MutableLongCollectionpublic com.gs.collections.api.bag.primitive.ImmutableLongBag toImmutable()
com.gs.collections.api.bag.primitive.MutableLongBagtoImmutable in interface com.gs.collections.api.bag.primitive.LongBagtoImmutable in interface com.gs.collections.api.bag.primitive.MutableLongBagtoImmutable in interface com.gs.collections.api.collection.primitive.MutableLongCollectionpublic com.gs.collections.api.iterator.LongIterator longIterator()
longIterator in interface com.gs.collections.api.LongIterablepublic 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.IOException