@NotThreadSafe public final class IntHashBag extends AbstractIntIterable 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... elements) |
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,
String start,
String separator,
String end)
Prints a string representation of this collection onto the given
Appendable . |
MutableIntBag |
asSynchronized() |
MutableIntBag |
asUnmodifiable() |
MutableList<IntIntPair> |
bottomOccurrences(int count)
Returns the
count least frequently occurring items. |
void |
clear() |
<V> MutableBag<V> |
collect(IntToObjectFunction<? extends V> function) |
boolean |
contains(int value) |
int |
count(IntPredicate predicate) |
int |
detectIfNone(IntPredicate predicate,
int ifNone) |
void |
each(IntProcedure procedure) |
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) |
MutableIntIterator |
intIterator() |
boolean |
isEmpty()
Returns true if this iterable has zero items.
|
int |
max() |
int |
min() |
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) |
IntHashBag |
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() |
int[] |
toArray() |
ImmutableIntBag |
toImmutable()
Returns an immutable copy of this bag.
|
MutableList<IntIntPair> |
topOccurrences(int count)
Returns the
count most frequently occurring items. |
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) |
asLazy, average, containsAll, containsAll, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toString
asLazy, average, containsAll, containsAll, maxIfEmpty, median, minIfEmpty, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedList
appendString, appendString, makeString, makeString, makeString, toString
public IntHashBag()
public IntHashBag(int size)
public IntHashBag(IntIterable iterable)
public IntHashBag(int... elements)
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()
PrimitiveIterable
isEmpty
in interface PrimitiveIterable
public boolean notEmpty()
PrimitiveIterable
notEmpty
in interface PrimitiveIterable
public int size()
PrimitiveIterable
size
in interface PrimitiveIterable
public int sizeDistinct()
IntBag
sizeDistinct
in interface IntBag
public void clear()
clear
in interface MutableIntCollection
public IntHashBag with(int element)
with
in interface MutableIntBag
with
in interface MutableIntCollection
public IntHashBag with(int element1, int element2)
public IntHashBag with(int element1, int element2, int element3)
public IntHashBag withAll(IntIterable iterable)
withAll
in interface MutableIntBag
withAll
in interface MutableIntCollection
public IntHashBag without(int element)
without
in interface MutableIntBag
without
in interface MutableIntCollection
public IntHashBag withoutAll(IntIterable iterable)
withoutAll
in interface MutableIntBag
withoutAll
in interface MutableIntCollection
public boolean contains(int value)
contains
in interface IntIterable
public int occurrencesOf(int item)
IntBag
occurrencesOf
in interface IntBag
public void forEachWithOccurrences(IntIntProcedure procedure)
IntBag
forEachWithOccurrences
in interface IntBag
public IntHashBag selectByOccurrences(IntPredicate predicate)
MutableIntBag
selectByOccurrences
in interface IntBag
selectByOccurrences
in interface MutableIntBag
public MutableList<IntIntPair> topOccurrences(int count)
MutableIntBag
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 IntBag
topOccurrences
in interface MutableIntBag
public MutableList<IntIntPair> bottomOccurrences(int count)
MutableIntBag
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 IntBag
bottomOccurrences
in interface MutableIntBag
public boolean add(int item)
add
in interface MutableIntCollection
public boolean remove(int item)
remove
in interface MutableIntCollection
public boolean addAll(int... source)
addAll
in interface MutableIntCollection
public boolean addAll(IntIterable source)
addAll
in interface MutableIntCollection
public boolean removeAll(int... source)
removeAll
in interface MutableIntCollection
public boolean removeAll(IntIterable source)
removeAll
in interface MutableIntCollection
public boolean retainAll(IntIterable source)
retainAll
in interface MutableIntCollection
Collection.retainAll(Collection)
public boolean retainAll(int... source)
retainAll
in interface MutableIntCollection
Collection.retainAll(Collection)
public void addOccurrences(int item, int occurrences)
addOccurrences
in interface MutableIntBag
public boolean removeOccurrences(int item, int occurrences)
removeOccurrences
in interface MutableIntBag
public void forEach(IntProcedure procedure)
forEach
in interface IntIterable
public void each(IntProcedure procedure)
each
in interface IntIterable
public IntHashBag select(IntPredicate predicate)
select
in interface IntBag
select
in interface MutableIntBag
select
in interface MutableIntCollection
select
in interface IntIterable
public IntHashBag reject(IntPredicate predicate)
reject
in interface IntBag
reject
in interface MutableIntBag
reject
in interface MutableIntCollection
reject
in interface IntIterable
public <T> T injectInto(T injectedValue, ObjectIntToObjectFunction<? super T,? extends T> function)
injectInto
in interface IntIterable
public boolean equals(Object otherBag)
IntBag
Bag.equals(Object)
.public int hashCode()
IntBag
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(IntPredicate predicate)
count
in interface IntIterable
public boolean anySatisfy(IntPredicate predicate)
anySatisfy
in interface IntIterable
public boolean allSatisfy(IntPredicate predicate)
allSatisfy
in interface IntIterable
public boolean noneSatisfy(IntPredicate predicate)
noneSatisfy
in interface IntIterable
public int detectIfNone(IntPredicate predicate, int ifNone)
detectIfNone
in interface IntIterable
public <V> MutableBag<V> collect(IntToObjectFunction<? extends V> function)
collect
in interface IntBag
collect
in interface MutableIntBag
collect
in interface MutableIntCollection
collect
in interface IntIterable
public int max()
max
in interface IntIterable
public int min()
min
in interface IntIterable
public long sum()
sum
in interface IntIterable
public int[] toArray()
toArray
in interface IntIterable
public MutableIntBag asUnmodifiable()
asUnmodifiable
in interface MutableIntBag
asUnmodifiable
in interface MutableIntCollection
public MutableIntBag asSynchronized()
asSynchronized
in interface MutableIntBag
asSynchronized
in interface MutableIntCollection
public ImmutableIntBag toImmutable()
MutableIntBag
toImmutable
in interface IntBag
toImmutable
in interface MutableIntBag
toImmutable
in interface MutableIntCollection
public MutableIntIterator intIterator()
intIterator
in interface MutableIntCollection
intIterator
in interface IntIterable
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.