Externalizable
, Serializable
, MutableIntCollection
, IntIterable
, PrimitiveIterable
, IntSet
, MutableIntSet
public class IntHashSet extends AbstractIntSet implements MutableIntSet, Externalizable
Constructor | Description |
---|---|
IntHashSet() |
|
IntHashSet(int initialCapacity) |
|
IntHashSet(int... elements) |
|
IntHashSet(IntHashSet set) |
Modifier and Type | Method | Description |
---|---|---|
boolean |
add(int element) |
|
boolean |
addAll(int... source) |
|
boolean |
addAll(IntIterable source) |
|
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(Appendable appendable,
String start,
String separator,
String end) |
Prints a string representation of this collection onto the given
Appendable . |
MutableIntSet |
asSynchronized() |
|
MutableIntSet |
asUnmodifiable() |
|
RichIterable<IntIterable> |
chunk(int size) |
Partitions elements in fixed size chunks.
|
void |
clear() |
|
<V> MutableSet<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.
|
<V,R extends Collection<V>> |
collect(IntToObjectFunction<? extends V> function,
R target) |
Same as
IntIterable.collect(IntToObjectFunction) , only the results are added to the target Collection. |
void |
compact() |
Rehashes every element in the set into a new backing table of the smallest possible size and eliminating removed sentinels.
|
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.
|
void |
forEach(IntProcedure procedure) |
Applies the IntProcedure to each element in the IntIterable.
|
IntSet |
freeze() |
Returns a frozen copy of this set.
|
int |
hashCode() |
Follows the same general contract as
Set.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.
|
int |
max() |
|
int |
min() |
|
IntHashSet |
newEmpty() |
Creates a new empty IntHashSet.
|
static IntHashSet |
newSet(IntIterable source) |
|
static IntHashSet |
newSetWith(int... source) |
|
boolean |
noneSatisfy(IntPredicate predicate) |
Returns true if none of the elements in the IntIterable return true for the
specified predicate, otherwise returns false.
|
void |
readExternal(ObjectInput in) |
|
IntHashSet |
reject(IntPredicate predicate) |
Returns a new IntIterable with all of the elements in the IntIterable that
return false for the specified predicate.
|
<R extends MutableIntCollection> |
reject(IntPredicate predicate,
R target) |
Same as
IntIterable.reject(IntPredicate) , only the results are added to the target MutableIntCollection. |
boolean |
remove(int value) |
|
boolean |
removeAll(int... source) |
|
boolean |
removeAll(IntIterable source) |
|
boolean |
retainAll(int... source) |
|
boolean |
retainAll(IntIterable source) |
|
IntHashSet |
select(IntPredicate predicate) |
Returns a new IntIterable with all of the elements in the IntIterable that
return true for the specified predicate.
|
<R extends MutableIntCollection> |
select(IntPredicate predicate,
R target) |
Same as
IntIterable.select(IntPredicate) , only the results are added to the target MutableIntCollection. |
int |
size() |
Returns the number of items in this iterable.
|
long |
sum() |
|
int[] |
toArray() |
Converts the IntIterable to a primitive int array.
|
ImmutableIntSet |
toImmutable() |
Returns an immutable copy of this set.
|
IntHashSet |
with(int element) |
|
IntHashSet |
withAll(IntIterable elements) |
|
IntHashSet |
without(int element) |
|
IntHashSet |
withoutAll(IntIterable elements) |
|
void |
writeExternal(ObjectOutput out) |
asLazy, average, containsAll, containsAll, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toString
equals
asLazy, average, averageIfEmpty, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAll, containsAll, flatCollect, maxIfEmpty, median, medianIfEmpty, minIfEmpty, reduce, reduceIfEmpty, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedList
removeIf
tap
appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, toString
public IntHashSet()
public IntHashSet(int initialCapacity)
public IntHashSet(int... elements)
public IntHashSet(IntHashSet set)
public static IntHashSet newSet(IntIterable source)
public static IntHashSet newSetWith(int... source)
public int hashCode()
IntSet
Set.hashCode()
.hashCode
in interface IntSet
hashCode
in class AbstractIntSet
public int size()
PrimitiveIterable
size
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 boolean add(int element)
add
in interface MutableIntCollection
public boolean addAll(int... source)
addAll
in interface MutableIntCollection
public boolean addAll(IntIterable source)
addAll
in interface MutableIntCollection
public boolean remove(int value)
remove
in interface MutableIntCollection
public boolean removeAll(IntIterable source)
removeAll
in interface MutableIntCollection
public boolean removeAll(int... 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 clear()
clear
in interface MutableIntCollection
public IntHashSet with(int element)
with
in interface MutableIntCollection
with
in interface MutableIntSet
public IntHashSet without(int element)
without
in interface MutableIntCollection
without
in interface MutableIntSet
public IntHashSet withAll(IntIterable elements)
withAll
in interface MutableIntCollection
withAll
in interface MutableIntSet
public IntHashSet withoutAll(IntIterable elements)
withoutAll
in interface MutableIntCollection
withoutAll
in interface MutableIntSet
public MutableIntSet asUnmodifiable()
asUnmodifiable
in interface MutableIntCollection
asUnmodifiable
in interface MutableIntSet
public MutableIntSet asSynchronized()
asSynchronized
in interface MutableIntCollection
asSynchronized
in interface MutableIntSet
public ImmutableIntSet toImmutable()
MutableIntSet
toImmutable
in interface IntSet
toImmutable
in interface MutableIntCollection
toImmutable
in interface MutableIntSet
public MutableIntIterator intIterator()
IntIterable
intIterator
in interface IntIterable
intIterator
in interface MutableIntCollection
public int[] toArray()
IntIterable
toArray
in interface IntIterable
public boolean contains(int value)
IntIterable
contains
in interface IntIterable
public void forEach(IntProcedure procedure)
IntIterable
forEach
in interface IntIterable
public void each(IntProcedure procedure)
IntIterable
each
in interface IntIterable
public IntHashSet select(IntPredicate predicate)
IntIterable
select
in interface IntIterable
select
in interface IntSet
select
in interface MutableIntCollection
select
in interface MutableIntSet
public <R extends MutableIntCollection> R select(IntPredicate predicate, R target)
IntIterable
IntIterable.select(IntPredicate)
, only the results are added to the target MutableIntCollection.select
in interface IntIterable
public IntHashSet reject(IntPredicate predicate)
IntIterable
reject
in interface IntIterable
reject
in interface IntSet
reject
in interface MutableIntCollection
reject
in interface MutableIntSet
public <R extends MutableIntCollection> R reject(IntPredicate predicate, R target)
IntIterable
IntIterable.reject(IntPredicate)
, only the results are added to the target MutableIntCollection.reject
in interface IntIterable
public <V> MutableSet<V> collect(IntToObjectFunction<? extends V> function)
IntIterable
collect
in interface IntIterable
collect
in interface IntSet
collect
in interface MutableIntCollection
collect
in interface MutableIntSet
public <V,R extends Collection<V>> R collect(IntToObjectFunction<? extends V> function, R target)
IntIterable
IntIterable.collect(IntToObjectFunction)
, only the results are added to the target Collection.collect
in interface IntIterable
public int detectIfNone(IntPredicate predicate, int ifNone)
detectIfNone
in interface IntIterable
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 long sum()
sum
in interface IntIterable
public int max()
max
in interface IntIterable
public int min()
min
in interface IntIterable
public IntSet freeze()
MutableIntSet
freeze
in interface IntSet
freeze
in interface MutableIntSet
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException
readExternal
in interface Externalizable
IOException
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 IntHashSet newEmpty()
newEmpty
in interface MutableIntCollection
newEmpty
in interface MutableIntSet
public void compact()
Copyright © 2004–2019. All rights reserved.