Class IntHashBag
- java.lang.Object
-
- org.eclipse.collections.impl.primitive.AbstractIntIterable
-
- org.eclipse.collections.impl.bag.mutable.primitive.IntHashBag
-
- All Implemented Interfaces:
Externalizable
,Serializable
,IntBag
,MutableIntBag
,MutableIntCollection
,IntIterable
,PrimitiveIterable
public class IntHashBag extends AbstractIntIterable implements MutableIntBag, Externalizable
IntHashBag is similar toHashBag
, and is memory-optimized for int primitives. This file was automatically generated from template file primitiveHashBag.stg.- Since:
- 3.0.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description IntHashBag()
IntHashBag(int size)
IntHashBag(int... elements)
IntHashBag(IntIterable iterable)
IntHashBag(IntHashBag bag)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods 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)
boolean
anySatisfy(IntPredicate predicate)
void
appendString(Appendable appendable, String start, String separator, String end)
MutableIntBag
asSynchronized()
MutableIntBag
asUnmodifiable()
MutableList<IntIntPair>
bottomOccurrences(int count)
RichIterable<IntIterable>
chunk(int size)
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)
void
forEachWithOccurrences(IntIntProcedure procedure)
int
hashCode()
<T> T
injectInto(T injectedValue, ObjectIntToObjectFunction<? super T,? extends T> function)
MutableIntIterator
intIterator()
boolean
isEmpty()
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)
boolean
notEmpty()
int
occurrencesOf(int item)
void
readExternal(ObjectInput in)
IntHashBag
reject(IntPredicate 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)
IntHashBag
selectByOccurrences(IntPredicate predicate)
MutableIntSet
selectUnique()
int
size()
int
sizeDistinct()
long
sum()
int[]
toArray()
int[]
toArray(int[] array)
ImmutableIntBag
toImmutable()
MutableList<IntIntPair>
topOccurrences(int count)
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)
-
Methods inherited from class org.eclipse.collections.impl.primitive.AbstractIntIterable
asLazy, average, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toString
-
Methods inherited from interface org.eclipse.collections.api.bag.primitive.IntBag
toStringOfItemToCount
-
Methods inherited from interface org.eclipse.collections.api.IntIterable
asLazy, average, averageIfEmpty, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAll, containsAll, containsAny, containsAny, containsNone, containsNone, flatCollect, forEach, injectIntoBoolean, injectIntoByte, injectIntoChar, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, injectIntoShort, maxIfEmpty, median, medianIfEmpty, minIfEmpty, reduce, reduceIfEmpty, reject, select, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedList, toSortedList, toSortedListBy, toSortedListBy
-
Methods inherited from interface org.eclipse.collections.api.bag.primitive.MutableIntBag
selectDuplicates, tap
-
Methods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, makeString, makeString, makeString, toString
-
-
-
-
Constructor Detail
-
IntHashBag
public IntHashBag()
-
IntHashBag
public IntHashBag(int size)
-
IntHashBag
public IntHashBag(IntIterable iterable)
-
IntHashBag
public IntHashBag(int... elements)
-
IntHashBag
public IntHashBag(IntHashBag bag)
-
-
Method Detail
-
newBag
public static IntHashBag newBag(int size)
-
newBagWith
public static IntHashBag newBagWith(int... source)
-
newBag
public static IntHashBag newBag(IntIterable source)
-
newBag
public static IntHashBag newBag(IntBag source)
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacePrimitiveIterable
-
notEmpty
public boolean notEmpty()
- Specified by:
notEmpty
in interfacePrimitiveIterable
-
size
public int size()
- Specified by:
size
in interfacePrimitiveIterable
-
sizeDistinct
public int sizeDistinct()
- Specified by:
sizeDistinct
in interfaceIntBag
-
clear
public void clear()
- Specified by:
clear
in interfaceMutableIntCollection
-
with
public IntHashBag with(int element)
- Specified by:
with
in interfaceMutableIntBag
- Specified by:
with
in interfaceMutableIntCollection
-
with
public IntHashBag with(int element1, int element2)
-
with
public IntHashBag with(int element1, int element2, int element3)
-
withAll
public IntHashBag withAll(IntIterable iterable)
- Specified by:
withAll
in interfaceMutableIntBag
- Specified by:
withAll
in interfaceMutableIntCollection
-
without
public IntHashBag without(int element)
- Specified by:
without
in interfaceMutableIntBag
- Specified by:
without
in interfaceMutableIntCollection
-
withoutAll
public IntHashBag withoutAll(IntIterable iterable)
- Specified by:
withoutAll
in interfaceMutableIntBag
- Specified by:
withoutAll
in interfaceMutableIntCollection
-
contains
public boolean contains(int value)
- Specified by:
contains
in interfaceIntIterable
-
occurrencesOf
public int occurrencesOf(int item)
- Specified by:
occurrencesOf
in interfaceIntBag
-
forEachWithOccurrences
public void forEachWithOccurrences(IntIntProcedure procedure)
- Specified by:
forEachWithOccurrences
in interfaceIntBag
-
selectByOccurrences
public IntHashBag selectByOccurrences(IntPredicate predicate)
- Specified by:
selectByOccurrences
in interfaceIntBag
- Specified by:
selectByOccurrences
in interfaceMutableIntBag
-
selectUnique
public MutableIntSet selectUnique()
- Specified by:
selectUnique
in interfaceIntBag
- Specified by:
selectUnique
in interfaceMutableIntBag
-
topOccurrences
public MutableList<IntIntPair> topOccurrences(int count)
- Specified by:
topOccurrences
in interfaceIntBag
- Specified by:
topOccurrences
in interfaceMutableIntBag
-
bottomOccurrences
public MutableList<IntIntPair> bottomOccurrences(int count)
- Specified by:
bottomOccurrences
in interfaceIntBag
- Specified by:
bottomOccurrences
in interfaceMutableIntBag
-
add
public boolean add(int item)
- Specified by:
add
in interfaceMutableIntCollection
-
remove
public boolean remove(int item)
- Specified by:
remove
in interfaceMutableIntCollection
-
removeIf
public boolean removeIf(IntPredicate predicate)
- Specified by:
removeIf
in interfaceMutableIntCollection
-
addAll
public boolean addAll(int... source)
- Specified by:
addAll
in interfaceMutableIntCollection
-
addAll
public boolean addAll(IntIterable source)
- Specified by:
addAll
in interfaceMutableIntCollection
-
removeAll
public boolean removeAll(int... source)
- Specified by:
removeAll
in interfaceMutableIntCollection
-
removeAll
public boolean removeAll(IntIterable source)
- Specified by:
removeAll
in interfaceMutableIntCollection
-
retainAll
public boolean retainAll(IntIterable source)
- Specified by:
retainAll
in interfaceMutableIntCollection
-
retainAll
public boolean retainAll(int... source)
- Specified by:
retainAll
in interfaceMutableIntCollection
-
addOccurrences
public void addOccurrences(int item, int occurrences)
- Specified by:
addOccurrences
in interfaceMutableIntBag
-
removeOccurrences
public boolean removeOccurrences(int item, int occurrences)
- Specified by:
removeOccurrences
in interfaceMutableIntBag
-
each
public void each(IntProcedure procedure)
- Specified by:
each
in interfaceIntIterable
- Since:
- 7.0.
-
select
public IntHashBag select(IntPredicate predicate)
- Specified by:
select
in interfaceIntBag
- Specified by:
select
in interfaceIntIterable
- Specified by:
select
in interfaceMutableIntBag
- Specified by:
select
in interfaceMutableIntCollection
-
reject
public IntHashBag reject(IntPredicate predicate)
- Specified by:
reject
in interfaceIntBag
- Specified by:
reject
in interfaceIntIterable
- Specified by:
reject
in interfaceMutableIntBag
- Specified by:
reject
in interfaceMutableIntCollection
-
injectInto
public <T> T injectInto(T injectedValue, ObjectIntToObjectFunction<? super T,? extends T> function)
- Specified by:
injectInto
in interfaceIntIterable
-
chunk
public RichIterable<IntIterable> chunk(int size)
- Specified by:
chunk
in interfaceIntIterable
-
equals
public boolean equals(Object otherBag)
-
hashCode
public int hashCode()
-
appendString
public void appendString(Appendable appendable, String start, String separator, String end)
- Specified by:
appendString
in interfacePrimitiveIterable
-
count
public int count(IntPredicate predicate)
- Specified by:
count
in interfaceIntIterable
-
anySatisfy
public boolean anySatisfy(IntPredicate predicate)
- Specified by:
anySatisfy
in interfaceIntIterable
-
allSatisfy
public boolean allSatisfy(IntPredicate predicate)
- Specified by:
allSatisfy
in interfaceIntIterable
-
noneSatisfy
public boolean noneSatisfy(IntPredicate predicate)
- Specified by:
noneSatisfy
in interfaceIntIterable
-
detectIfNone
public int detectIfNone(IntPredicate predicate, int ifNone)
- Specified by:
detectIfNone
in interfaceIntIterable
-
collect
public <V> MutableBag<V> collect(IntToObjectFunction<? extends V> function)
- Specified by:
collect
in interfaceIntBag
- Specified by:
collect
in interfaceIntIterable
- Specified by:
collect
in interfaceMutableIntBag
- Specified by:
collect
in interfaceMutableIntCollection
-
max
public int max()
- Specified by:
max
in interfaceIntIterable
-
min
public int min()
- Specified by:
min
in interfaceIntIterable
-
sum
public long sum()
- Specified by:
sum
in interfaceIntIterable
-
toArray
public int[] toArray()
- Specified by:
toArray
in interfaceIntIterable
-
toArray
public int[] toArray(int[] array)
- Specified by:
toArray
in interfaceIntIterable
-
asUnmodifiable
public MutableIntBag asUnmodifiable()
- Specified by:
asUnmodifiable
in interfaceMutableIntBag
- Specified by:
asUnmodifiable
in interfaceMutableIntCollection
-
asSynchronized
public MutableIntBag asSynchronized()
- Specified by:
asSynchronized
in interfaceMutableIntBag
- Specified by:
asSynchronized
in interfaceMutableIntCollection
-
toImmutable
public ImmutableIntBag toImmutable()
- Specified by:
toImmutable
in interfaceIntBag
- Specified by:
toImmutable
in interfaceMutableIntBag
- Specified by:
toImmutable
in interfaceMutableIntCollection
-
newEmpty
public IntHashBag newEmpty()
Creates a new empty IntHashBag.- Specified by:
newEmpty
in interfaceMutableIntBag
- Specified by:
newEmpty
in interfaceMutableIntCollection
- Since:
- 9.2.
-
intIterator
public MutableIntIterator intIterator()
- Specified by:
intIterator
in interfaceIntIterable
- Specified by:
intIterator
in interfaceMutableIntCollection
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
-
-