Externalizable
, Serializable
, LongBag
, MutableLongBag
, MutableLongCollection
, LongIterable
, PrimitiveIterable
@NotThreadSafe public final class LongHashBag extends AbstractLongIterable implements MutableLongBag, 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(Appendable appendable,
String start,
String separator,
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. |
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(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) |
|
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(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 |
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.
|
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(ObjectOutput out) |
asLazy, average, containsAll, containsAll, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toString
asLazy, average, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAll, containsAll, flatCollect, maxIfEmpty, median, minIfEmpty, reject, select, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedList
appendString, appendString, makeString, makeString, makeString, toString
public 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()
PrimitiveIterable
isEmpty
in interface PrimitiveIterable
public boolean notEmpty()
PrimitiveIterable
notEmpty
in interface PrimitiveIterable
public int size()
PrimitiveIterable
size
in interface PrimitiveIterable
public int sizeDistinct()
LongBag
sizeDistinct
in interface LongBag
public void clear()
clear
in interface MutableLongCollection
public LongHashBag with(long element)
with
in interface MutableLongBag
with
in interface MutableLongCollection
public LongHashBag with(long element1, long element2)
public LongHashBag with(long element1, long element2, long element3)
public LongHashBag withAll(LongIterable iterable)
withAll
in interface MutableLongBag
withAll
in interface MutableLongCollection
public LongHashBag without(long element)
without
in interface MutableLongBag
without
in interface MutableLongCollection
public LongHashBag withoutAll(LongIterable iterable)
withoutAll
in interface MutableLongBag
withoutAll
in interface MutableLongCollection
public boolean contains(long value)
LongIterable
contains
in interface LongIterable
public int occurrencesOf(long item)
LongBag
occurrencesOf
in interface LongBag
public void forEachWithOccurrences(LongIntProcedure procedure)
LongBag
forEachWithOccurrences
in interface LongBag
public LongHashBag selectByOccurrences(IntPredicate predicate)
MutableLongBag
selectByOccurrences
in interface LongBag
selectByOccurrences
in interface MutableLongBag
public MutableList<LongIntPair> topOccurrences(int count)
MutableLongBag
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 LongBag
topOccurrences
in interface MutableLongBag
public MutableList<LongIntPair> bottomOccurrences(int count)
MutableLongBag
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 LongBag
bottomOccurrences
in interface MutableLongBag
public boolean add(long item)
add
in interface MutableLongCollection
public boolean remove(long item)
remove
in interface MutableLongCollection
public boolean addAll(long... source)
addAll
in interface MutableLongCollection
public boolean addAll(LongIterable source)
addAll
in interface MutableLongCollection
public boolean removeAll(long... source)
removeAll
in interface MutableLongCollection
public boolean removeAll(LongIterable source)
removeAll
in interface MutableLongCollection
public boolean retainAll(LongIterable source)
retainAll
in interface MutableLongCollection
Collection.retainAll(Collection)
public boolean retainAll(long... source)
retainAll
in interface MutableLongCollection
Collection.retainAll(Collection)
public void addOccurrences(long item, int occurrences)
addOccurrences
in interface MutableLongBag
public boolean removeOccurrences(long item, int occurrences)
removeOccurrences
in interface MutableLongBag
public void forEach(LongProcedure procedure)
LongIterable
forEach
in interface LongIterable
public void each(LongProcedure procedure)
LongIterable
each
in interface LongIterable
public LongHashBag select(LongPredicate predicate)
LongIterable
select
in interface LongBag
select
in interface LongIterable
select
in interface MutableLongBag
select
in interface MutableLongCollection
public LongHashBag reject(LongPredicate predicate)
LongIterable
reject
in interface LongBag
reject
in interface LongIterable
reject
in interface MutableLongBag
reject
in interface MutableLongCollection
public <T> T injectInto(T injectedValue, ObjectLongToObjectFunction<? super T,? extends T> function)
injectInto
in interface LongIterable
public boolean equals(Object otherBag)
LongBag
Bag.equals(Object)
.public int hashCode()
LongBag
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(LongPredicate predicate)
LongIterable
count
in interface LongIterable
public boolean anySatisfy(LongPredicate predicate)
LongIterable
anySatisfy
in interface LongIterable
public boolean allSatisfy(LongPredicate predicate)
LongIterable
allSatisfy
in interface LongIterable
public boolean noneSatisfy(LongPredicate predicate)
LongIterable
noneSatisfy
in interface LongIterable
public long detectIfNone(LongPredicate predicate, long ifNone)
detectIfNone
in interface LongIterable
public <V> MutableBag<V> collect(LongToObjectFunction<? extends V> function)
LongIterable
collect
in interface LongBag
collect
in interface LongIterable
collect
in interface MutableLongBag
collect
in interface MutableLongCollection
public long max()
max
in interface LongIterable
public long min()
min
in interface LongIterable
public long sum()
sum
in interface LongIterable
public long[] toArray()
LongIterable
toArray
in interface LongIterable
public MutableLongBag asUnmodifiable()
asUnmodifiable
in interface MutableLongBag
asUnmodifiable
in interface MutableLongCollection
public MutableLongBag asSynchronized()
asSynchronized
in interface MutableLongBag
asSynchronized
in interface MutableLongCollection
public ImmutableLongBag toImmutable()
MutableLongBag
toImmutable
in interface LongBag
toImmutable
in interface MutableLongBag
toImmutable
in interface MutableLongCollection
public MutableLongIterator longIterator()
LongIterable
longIterator
in interface LongIterable
longIterator
in interface MutableLongCollection
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–2017. All rights reserved.