@NotThreadSafe public final class LongHashBag extends Object implements MutableLongBag, 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(LongIterable iterable) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(long item) |
boolean |
addAll(long... source) |
boolean |
addAll(LongIterable source) |
void |
addOccurrences(long item,
int occurrences) |
boolean |
allSatisfy(LongPredicate predicate) |
boolean |
anySatisfy(LongPredicate predicate) |
void |
appendString(Appendable appendable)
Prints a string representation of this collection onto the given
Appendable . |
void |
appendString(Appendable appendable,
String separator)
Prints a string representation of this collection onto the given
Appendable . |
void |
appendString(Appendable appendable,
String start,
String separator,
String end)
Prints a string representation of this collection onto the given
Appendable . |
LazyLongIterable |
asLazy() |
MutableLongBag |
asSynchronized() |
MutableLongBag |
asUnmodifiable() |
double |
average() |
void |
clear() |
<V> MutableBag<V> |
collect(LongToObjectFunction<? extends V> function) |
boolean |
contains(long value) |
boolean |
containsAll(long... source) |
boolean |
containsAll(LongIterable source) |
int |
count(LongPredicate predicate) |
long |
detectIfNone(LongPredicate predicate,
long ifNone) |
boolean |
equals(Object otherBag)
Follows the same general contract as
Bag.equals(Object) . |
void |
forEach(LongProcedure procedure) |
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.
|
LongIterator |
longIterator() |
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). |
String |
makeString(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). |
String |
makeString(String start,
String separator,
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(LongBag source) |
static LongHashBag |
newBag(LongIterable source) |
static LongHashBag |
newBagWith(long... source) |
boolean |
noneSatisfy(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(ObjectInput in) |
LongHashBag |
reject(LongPredicate 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) |
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() |
MutableLongBag |
toBag() |
ImmutableLongBag |
toImmutable()
Returns an immutable copy of this bag.
|
MutableLongList |
toList() |
MutableLongSet |
toSet() |
long[] |
toSortedArray() |
MutableLongList |
toSortedList() |
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(LongIterable iterable) |
LongHashBag |
without(long element) |
LongHashBag |
withoutAll(LongIterable iterable) |
void |
writeExternal(ObjectOutput out) |
public LongHashBag()
public LongHashBag(int size)
public LongHashBag(LongIterable iterable)
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)
contains
in interface LongIterable
public boolean containsAll(long... source)
containsAll
in interface LongIterable
public boolean containsAll(LongIterable source)
containsAll
in interface LongIterable
public int occurrencesOf(long item)
LongBag
occurrencesOf
in interface LongBag
public void forEachWithOccurrences(LongIntProcedure procedure)
LongBag
forEachWithOccurrences
in interface LongBag
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)
forEach
in interface LongIterable
public LongHashBag select(LongPredicate predicate)
select
in interface LongBag
select
in interface MutableLongBag
select
in interface MutableLongCollection
select
in interface LongIterable
public LongHashBag reject(LongPredicate predicate)
reject
in interface LongBag
reject
in interface MutableLongBag
reject
in interface MutableLongCollection
reject
in interface LongIterable
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 String toString()
PrimitiveIterable
toString
in interface PrimitiveIterable
toString
in class Object
public String makeString()
PrimitiveIterable
PrimitiveIterable.makeString(String)
and defaulting
the separator parameter to the characters ", " (comma and space).makeString
in interface PrimitiveIterable
public String makeString(String separator)
PrimitiveIterable
PrimitiveIterable.makeString(String, String, String)
and defaulting the start and end parameters to "" (the empty String).makeString
in interface PrimitiveIterable
public String makeString(String start, String separator, String end)
PrimitiveIterable
makeString
in interface PrimitiveIterable
public void appendString(Appendable appendable)
PrimitiveIterable
Appendable
. Prints the string returned
by PrimitiveIterable.makeString()
.appendString
in interface PrimitiveIterable
public void appendString(Appendable appendable, String separator)
PrimitiveIterable
Appendable
. Prints the string returned
by PrimitiveIterable.makeString(String)
.appendString
in interface PrimitiveIterable
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)
count
in interface LongIterable
public boolean anySatisfy(LongPredicate predicate)
anySatisfy
in interface LongIterable
public boolean allSatisfy(LongPredicate predicate)
allSatisfy
in interface LongIterable
public boolean noneSatisfy(LongPredicate predicate)
noneSatisfy
in interface LongIterable
public long detectIfNone(LongPredicate predicate, long ifNone)
detectIfNone
in interface LongIterable
public <V> MutableBag<V> collect(LongToObjectFunction<? extends V> function)
collect
in interface LongBag
collect
in interface MutableLongBag
collect
in interface MutableLongCollection
collect
in interface LongIterable
public long max()
max
in interface LongIterable
public long min()
min
in interface LongIterable
public long sum()
sum
in interface LongIterable
public long minIfEmpty(long defaultValue)
minIfEmpty
in interface LongIterable
public long maxIfEmpty(long defaultValue)
maxIfEmpty
in interface LongIterable
public double average()
average
in interface LongIterable
public double median()
median
in interface LongIterable
public long[] toArray()
toArray
in interface LongIterable
public long[] toSortedArray()
toSortedArray
in interface LongIterable
public MutableLongList toList()
toList
in interface LongIterable
public MutableLongList toSortedList()
toSortedList
in interface LongIterable
public MutableLongSet toSet()
toSet
in interface LongIterable
public MutableLongBag toBag()
toBag
in interface LongIterable
public LazyLongIterable asLazy()
asLazy
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 LongIterator longIterator()
longIterator
in interface LongIterable
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–2016. All rights reserved.