java.io.Externalizable
, java.io.Serializable
, IntBag
, MutableIntBag
, MutableIntCollection
, IntIterable
, PrimitiveIterable
public class IntHashBag extends AbstractIntIterable implements MutableIntBag, java.io.Externalizable
HashBag
, and is memory-optimized for int primitives.
This file was automatically generated from template file primitiveHashBag.stg.Constructor | Description |
---|---|
IntHashBag() |
|
IntHashBag(int size) |
|
IntHashBag(int... elements) |
|
IntHashBag(IntIterable iterable) |
|
IntHashBag(IntHashBag bag) |
Modifier and Type | Method | Description |
---|---|---|
boolean |
add(int item) |
|
boolean |
addAll(int... source) |
|
boolean |
addAll(IntIterable source) |
|
void |
addOccurrences(int item,
int occurrences) |
|
boolean |
allSatisfy(IntPredicate predicate) |
Returns true if all of the elements in the IntIterable return true for the
specified predicate, otherwise returns false.
|
boolean |
anySatisfy(IntPredicate predicate) |
Returns true if any of the elements in the IntIterable return true for the
specified predicate, otherwise returns false.
|
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 . |
MutableIntBag |
asSynchronized() |
|
MutableIntBag |
asUnmodifiable() |
|
MutableList<IntIntPair> |
bottomOccurrences(int count) |
Returns the
count least frequently occurring items. |
RichIterable<IntIterable> |
chunk(int size) |
Partitions elements in fixed size chunks.
|
void |
clear() |
|
<V> MutableBag<V> |
collect(IntToObjectFunction<? extends V> function) |
Returns a new collection with the results of applying the specified function on each element of the source
collection.
|
boolean |
contains(int value) |
Returns true if the value is contained in the IntIterable, and false if it is not.
|
int |
count(IntPredicate predicate) |
Returns a count of the number of elements in the IntIterable that return true for the
specified predicate.
|
int |
detectIfNone(IntPredicate predicate,
int ifNone) |
|
void |
each(IntProcedure procedure) |
A synonym for forEach.
|
boolean |
equals(java.lang.Object otherBag) |
Follows the same general contract as
Bag.equals(Object) . |
void |
forEach(IntProcedure procedure) |
Applies the IntProcedure to each element in the IntIterable.
|
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() |
Returns a primitive iterator that can be used to iterate over the IntIterable in an
imperative style.
|
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) |
|
IntHashBag |
newEmpty() |
Creates a new empty IntHashBag.
|
boolean |
noneSatisfy(IntPredicate predicate) |
Returns true if none of the elements in the IntIterable return true for the
specified predicate, otherwise returns false.
|
boolean |
notEmpty() |
The English equivalent of !this.isEmpty()
|
int |
occurrencesOf(int item) |
The occurrences of a distinct item in the bag.
|
void |
readExternal(java.io.ObjectInput in) |
|
IntHashBag |
reject(IntPredicate predicate) |
Returns a new IntIterable with all of the elements in the IntIterable that
return false for the specified predicate.
|
boolean |
remove(int item) |
|
boolean |
removeAll(int... source) |
|
boolean |
removeAll(IntIterable source) |
|
boolean |
removeIf(IntPredicate predicate) |
|
boolean |
removeOccurrences(int item,
int occurrences) |
|
boolean |
retainAll(int... source) |
|
boolean |
retainAll(IntIterable source) |
|
IntHashBag |
select(IntPredicate predicate) |
Returns a new IntIterable with all of the elements in the IntIterable that
return true for the specified predicate.
|
IntHashBag |
selectByOccurrences(IntPredicate predicate) |
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.
|
MutableIntSet |
selectUnique() |
Returns all elements of the bag that have exactly one occurrence.
|
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() |
Converts the IntIterable to a primitive int array.
|
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(java.io.ObjectOutput out) |
asLazy, average, containsAll, containsAll, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toString
toStringOfItemToCount
asLazy, average, averageIfEmpty, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAll, containsAll, flatCollect, maxIfEmpty, median, medianIfEmpty, minIfEmpty, reject, select, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedList
selectDuplicates, tap
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)
IntIterable
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 MutableIntSet selectUnique()
MutableIntBag
selectUnique
in interface IntBag
selectUnique
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 removeIf(IntPredicate predicate)
removeIf
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)
IntIterable
forEach
in interface IntIterable
public void each(IntProcedure procedure)
IntIterable
each
in interface IntIterable
public IntHashBag select(IntPredicate predicate)
IntIterable
select
in interface IntBag
select
in interface IntIterable
select
in interface MutableIntBag
select
in interface MutableIntCollection
public IntHashBag reject(IntPredicate predicate)
IntIterable
reject
in interface IntBag
reject
in interface IntIterable
reject
in interface MutableIntBag
reject
in interface MutableIntCollection
public <T> T injectInto(T injectedValue, ObjectIntToObjectFunction<? super T,? extends T> function)
injectInto
in interface IntIterable
public RichIterable<IntIterable> chunk(int size)
IntIterable
chunk
in interface IntIterable
size
- the number of elements per chunkRichIterable
containing IntIterable
s of size size
, except the last will be
truncated if the elements don't divide evenly.public boolean equals(java.lang.Object otherBag)
IntBag
Bag.equals(Object)
.public int hashCode()
IntBag
Bag.hashCode()
.public void appendString(java.lang.Appendable appendable, java.lang.String start, java.lang.String separator, java.lang.String end)
PrimitiveIterable
Appendable
. Prints the string returned
by PrimitiveIterable.makeString(String, String, String)
.appendString
in interface PrimitiveIterable
public int count(IntPredicate predicate)
IntIterable
count
in interface IntIterable
public boolean anySatisfy(IntPredicate predicate)
IntIterable
anySatisfy
in interface IntIterable
public boolean allSatisfy(IntPredicate predicate)
IntIterable
allSatisfy
in interface IntIterable
public boolean noneSatisfy(IntPredicate predicate)
IntIterable
noneSatisfy
in interface IntIterable
public int detectIfNone(IntPredicate predicate, int ifNone)
detectIfNone
in interface IntIterable
public <V> MutableBag<V> collect(IntToObjectFunction<? extends V> function)
IntIterable
collect
in interface IntBag
collect
in interface IntIterable
collect
in interface MutableIntBag
collect
in interface MutableIntCollection
public int max()
max
in interface IntIterable
public int min()
min
in interface IntIterable
public long sum()
sum
in interface IntIterable
public int[] toArray()
IntIterable
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 IntHashBag newEmpty()
newEmpty
in interface MutableIntBag
newEmpty
in interface MutableIntCollection
public MutableIntIterator intIterator()
IntIterable
intIterator
in interface IntIterable
intIterator
in interface MutableIntCollection
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException
readExternal
in interface java.io.Externalizable
java.io.IOException
Copyright © 2004–2018. All rights reserved.