@NotThreadSafe public final class IntHashBag extends Object implements MutableIntBag, Externalizable
HashBag, and is memory-optimized for int primitives.
This file was automatically generated from template file primitiveHashBag.stg.| Constructor and Description |
|---|
IntHashBag() |
IntHashBag(int size) |
IntHashBag(IntHashBag bag) |
IntHashBag(IntIterable iterable) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(int item) |
boolean |
addAll(int... source) |
boolean |
addAll(IntIterable source) |
void |
addOccurrences(int item,
int occurrences) |
boolean |
allSatisfy(IntPredicate predicate) |
boolean |
anySatisfy(IntPredicate 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. |
LazyIntIterable |
asLazy() |
MutableIntBag |
asSynchronized() |
MutableIntBag |
asUnmodifiable() |
double |
average() |
void |
clear() |
<V> MutableBag<V> |
collect(IntToObjectFunction<? extends V> function) |
boolean |
contains(int value) |
boolean |
containsAll(int... source) |
boolean |
containsAll(IntIterable source) |
int |
count(IntPredicate predicate) |
int |
detectIfNone(IntPredicate predicate,
int ifNone) |
boolean |
equals(Object otherBag)
Follows the same general contract as
Bag.equals(Object). |
void |
forEach(IntProcedure procedure) |
void |
forEachWithOccurrences(IntIntProcedure 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,
ObjectIntToObjectFunction<? super T,? extends T> function) |
IntIterator |
intIterator() |
boolean |
isEmpty()
Returns true if this iterable has zero items.
|
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.
|
int |
max() |
int |
maxIfEmpty(int defaultValue) |
double |
median() |
int |
min() |
int |
minIfEmpty(int defaultValue) |
static IntHashBag |
newBag(int size) |
static IntHashBag |
newBag(IntBag source) |
static IntHashBag |
newBag(IntIterable source) |
static IntHashBag |
newBagWith(int... source) |
boolean |
noneSatisfy(IntPredicate predicate) |
boolean |
notEmpty()
The English equivalent of !this.isEmpty()
|
int |
occurrencesOf(int item)
The occurrences of a distinct item in the bag.
|
void |
readExternal(ObjectInput in) |
IntHashBag |
reject(IntPredicate predicate) |
boolean |
remove(int item) |
boolean |
removeAll(int... source) |
boolean |
removeAll(IntIterable source) |
boolean |
removeOccurrences(int item,
int occurrences) |
boolean |
retainAll(int... source) |
boolean |
retainAll(IntIterable source) |
IntHashBag |
select(IntPredicate 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() |
int[] |
toArray() |
MutableIntBag |
toBag() |
ImmutableIntBag |
toImmutable()
Returns an immutable copy of this bag.
|
MutableIntList |
toList() |
MutableIntSet |
toSet() |
int[] |
toSortedArray() |
MutableIntList |
toSortedList() |
String |
toString()
Returns a string representation of this PrimitiveIterable.
|
IntHashBag |
with(int element) |
IntHashBag |
with(int element1,
int element2) |
IntHashBag |
with(int element1,
int element2,
int element3) |
IntHashBag |
withAll(IntIterable iterable) |
IntHashBag |
without(int element) |
IntHashBag |
withoutAll(IntIterable iterable) |
void |
writeExternal(ObjectOutput out) |
public IntHashBag()
public IntHashBag(int size)
public IntHashBag(IntIterable iterable)
public IntHashBag(IntHashBag bag)
public static IntHashBag newBag(int size)
public static IntHashBag newBagWith(int... source)
public static IntHashBag newBag(IntIterable source)
public static IntHashBag newBag(IntBag source)
public boolean isEmpty()
PrimitiveIterableisEmpty in interface PrimitiveIterablepublic boolean notEmpty()
PrimitiveIterablenotEmpty in interface PrimitiveIterablepublic int size()
PrimitiveIterablesize in interface PrimitiveIterablepublic int sizeDistinct()
IntBagsizeDistinct in interface IntBagpublic void clear()
clear in interface MutableIntCollectionpublic IntHashBag with(int element)
with in interface MutableIntBagwith in interface MutableIntCollectionpublic IntHashBag with(int element1, int element2)
public IntHashBag with(int element1, int element2, int element3)
public IntHashBag withAll(IntIterable iterable)
withAll in interface MutableIntBagwithAll in interface MutableIntCollectionpublic IntHashBag without(int element)
without in interface MutableIntBagwithout in interface MutableIntCollectionpublic IntHashBag withoutAll(IntIterable iterable)
withoutAll in interface MutableIntBagwithoutAll in interface MutableIntCollectionpublic boolean contains(int value)
contains in interface IntIterablepublic boolean containsAll(int... source)
containsAll in interface IntIterablepublic boolean containsAll(IntIterable source)
containsAll in interface IntIterablepublic int occurrencesOf(int item)
IntBagoccurrencesOf in interface IntBagpublic void forEachWithOccurrences(IntIntProcedure procedure)
IntBagforEachWithOccurrences in interface IntBagpublic boolean add(int item)
add in interface MutableIntCollectionpublic boolean remove(int item)
remove in interface MutableIntCollectionpublic boolean addAll(int... source)
addAll in interface MutableIntCollectionpublic boolean addAll(IntIterable source)
addAll in interface MutableIntCollectionpublic boolean removeAll(int... source)
removeAll in interface MutableIntCollectionpublic boolean removeAll(IntIterable source)
removeAll in interface MutableIntCollectionpublic boolean retainAll(IntIterable source)
retainAll in interface MutableIntCollectionCollection.retainAll(Collection)public boolean retainAll(int... source)
retainAll in interface MutableIntCollectionCollection.retainAll(Collection)public void addOccurrences(int item,
int occurrences)
addOccurrences in interface MutableIntBagpublic boolean removeOccurrences(int item,
int occurrences)
removeOccurrences in interface MutableIntBagpublic void forEach(IntProcedure procedure)
forEach in interface IntIterablepublic IntHashBag select(IntPredicate predicate)
select in interface IntBagselect in interface MutableIntBagselect in interface MutableIntCollectionselect in interface IntIterablepublic IntHashBag reject(IntPredicate predicate)
reject in interface IntBagreject in interface MutableIntBagreject in interface MutableIntCollectionreject in interface IntIterablepublic <T> T injectInto(T injectedValue,
ObjectIntToObjectFunction<? super T,? extends T> function)
injectInto in interface IntIterablepublic boolean equals(Object otherBag)
IntBagBag.equals(Object).public int hashCode()
IntBagBag.hashCode().public String toString()
PrimitiveIterabletoString in interface PrimitiveIterabletoString in class Objectpublic String makeString()
PrimitiveIterablePrimitiveIterable.makeString(String) and defaulting
the separator parameter to the characters ", " (comma and space).makeString in interface PrimitiveIterablepublic String makeString(String separator)
PrimitiveIterablePrimitiveIterable.makeString(String, String, String)
and defaulting the start and end parameters to "" (the empty String).makeString in interface PrimitiveIterablepublic String makeString(String start, String separator, String end)
PrimitiveIterablemakeString in interface PrimitiveIterablepublic void appendString(Appendable appendable)
PrimitiveIterableAppendable. Prints the string returned
by PrimitiveIterable.makeString().appendString in interface PrimitiveIterablepublic void appendString(Appendable appendable, String separator)
PrimitiveIterableAppendable. Prints the string returned
by PrimitiveIterable.makeString(String).appendString in interface PrimitiveIterablepublic void appendString(Appendable appendable, String start, String separator, String end)
PrimitiveIterableAppendable. Prints the string returned
by PrimitiveIterable.makeString(String, String, String).appendString in interface PrimitiveIterablepublic int count(IntPredicate predicate)
count in interface IntIterablepublic boolean anySatisfy(IntPredicate predicate)
anySatisfy in interface IntIterablepublic boolean allSatisfy(IntPredicate predicate)
allSatisfy in interface IntIterablepublic boolean noneSatisfy(IntPredicate predicate)
noneSatisfy in interface IntIterablepublic int detectIfNone(IntPredicate predicate, int ifNone)
detectIfNone in interface IntIterablepublic <V> MutableBag<V> collect(IntToObjectFunction<? extends V> function)
collect in interface IntBagcollect in interface MutableIntBagcollect in interface MutableIntCollectioncollect in interface IntIterablepublic int max()
max in interface IntIterablepublic int min()
min in interface IntIterablepublic long sum()
sum in interface IntIterablepublic int minIfEmpty(int defaultValue)
minIfEmpty in interface IntIterablepublic int maxIfEmpty(int defaultValue)
maxIfEmpty in interface IntIterablepublic double average()
average in interface IntIterablepublic double median()
median in interface IntIterablepublic int[] toArray()
toArray in interface IntIterablepublic int[] toSortedArray()
toSortedArray in interface IntIterablepublic MutableIntList toList()
toList in interface IntIterablepublic MutableIntList toSortedList()
toSortedList in interface IntIterablepublic MutableIntSet toSet()
toSet in interface IntIterablepublic MutableIntBag toBag()
toBag in interface IntIterablepublic LazyIntIterable asLazy()
asLazy in interface IntIterablepublic MutableIntBag asUnmodifiable()
asUnmodifiable in interface MutableIntBagasUnmodifiable in interface MutableIntCollectionpublic MutableIntBag asSynchronized()
asSynchronized in interface MutableIntBagasSynchronized in interface MutableIntCollectionpublic ImmutableIntBag toImmutable()
MutableIntBagtoImmutable in interface IntBagtoImmutable in interface MutableIntBagtoImmutable in interface MutableIntCollectionpublic IntIterator intIterator()
intIterator in interface IntIterablepublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException
readExternal in interface ExternalizableIOExceptionCopyright © 2004–2017. All rights reserved.