Class CharHashSet
java.lang.Object
org.eclipse.collections.impl.primitive.AbstractCharIterable
org.eclipse.collections.impl.set.primitive.AbstractCharSet
org.eclipse.collections.impl.set.mutable.primitive.CharHashSet
- All Implemented Interfaces:
Externalizable
,Serializable
,CharIterable
,MutableCharCollection
,PrimitiveIterable
,CharSet
,MutableCharSet
public class CharHashSet extends AbstractCharSet implements MutableCharSet, Externalizable
This file was automatically generated from template file primitiveHashSet.stg.
- Since:
- 3.0.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description CharHashSet()
CharHashSet(char... elements)
CharHashSet(int initialCapacity)
CharHashSet(CharHashSet set)
-
Method Summary
Modifier and Type Method Description boolean
add(char element)
boolean
addAll(char... source)
boolean
addAll(CharIterable source)
boolean
allSatisfy(CharPredicate predicate)
Returns true if all of the elements in the CharIterable return true for the specified predicate, otherwise returns false.boolean
anySatisfy(CharPredicate predicate)
Returns true if any of the elements in the CharIterable 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 givenAppendable
.MutableCharSet
asSynchronized()
MutableCharSet
asUnmodifiable()
MutableCharIterator
charIterator()
Returns a primitive iterator that can be used to iterate over the CharIterable in an imperative style.RichIterable<CharIterable>
chunk(int size)
Partitions elements in fixed size chunks.void
clear()
<V> MutableSet<V>
collect(CharToObjectFunction<? 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>>
Rcollect(CharToObjectFunction<? extends V> function, R target)
Same asCharIterable.collect(CharToObjectFunction)
, 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(char value)
Returns true if the value is contained in the CharIterable, and false if it is not.int
count(CharPredicate predicate)
Returns a count of the number of elements in the CharIterable that return true for the specified predicate.char
detectIfNone(CharPredicate predicate, char ifNone)
void
each(CharProcedure procedure)
A synonym for forEach.void
forEach(CharProcedure procedure)
Applies the CharProcedure to each element in the CharIterable.CharSet
freeze()
Returns a frozen copy of this set.int
hashCode()
Follows the same general contract asSet.hashCode()
.<T> T
injectInto(T injectedValue, ObjectCharToObjectFunction<? super T,? extends T> function)
char
max()
char
min()
CharHashSet
newEmpty()
Creates a new empty CharHashSet.static CharHashSet
newSet(CharIterable source)
static CharHashSet
newSetWith(char... source)
boolean
noneSatisfy(CharPredicate predicate)
Returns true if none of the elements in the CharIterable return true for the specified predicate, otherwise returns false.void
readExternal(ObjectInput in)
CharHashSet
reject(CharPredicate predicate)
Returns a new CharIterable with all of the elements in the CharIterable that return false for the specified predicate.<R extends MutableCharCollection>
Rreject(CharPredicate predicate, R target)
Same asCharIterable.reject(CharPredicate)
, only the results are added to the target MutableCharCollection.boolean
remove(char value)
boolean
removeAll(char... source)
boolean
removeAll(CharIterable source)
boolean
retainAll(char... source)
boolean
retainAll(CharIterable source)
CharHashSet
select(CharPredicate predicate)
Returns a new CharIterable with all of the elements in the CharIterable that return true for the specified predicate.<R extends MutableCharCollection>
Rselect(CharPredicate predicate, R target)
Same asCharIterable.select(CharPredicate)
, only the results are added to the target MutableCharCollection.int
size()
Returns the number of items in this iterable.long
sum()
char[]
toArray()
Converts the CharIterable to a primitive char array.char[]
toArray(char[] array)
Converts the CharIterable to a primitive char array.ImmutableCharSet
toImmutable()
Returns an immutable copy of this set.CharHashSet
with(char element)
CharHashSet
withAll(CharIterable elements)
CharHashSet
without(char element)
CharHashSet
withoutAll(CharIterable elements)
void
writeExternal(ObjectOutput out)
Methods inherited from class org.eclipse.collections.impl.primitive.AbstractCharIterable
asLazy, average, containsAll, containsAll, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toString
Methods inherited from interface org.eclipse.collections.api.CharIterable
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
Methods inherited from interface org.eclipse.collections.api.collection.primitive.MutableCharCollection
removeIf
Methods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, toString
-
Constructor Details
-
CharHashSet
public CharHashSet() -
CharHashSet
public CharHashSet(int initialCapacity) -
CharHashSet
public CharHashSet(char... elements) -
CharHashSet
-
-
Method Details
-
newSet
-
newSetWith
-
hashCode
public int hashCode()Description copied from interface:CharSet
Follows the same general contract asSet.hashCode()
.- Specified by:
hashCode
in interfaceCharSet
- Specified by:
hashCode
in classAbstractCharSet
-
size
public int size()Description copied from interface:PrimitiveIterable
Returns the number of items in this iterable.- Specified by:
size
in interfacePrimitiveIterable
-
appendString
Description copied from interface:PrimitiveIterable
Prints a string representation of this collection onto the givenAppendable
. Prints the string returned byPrimitiveIterable.makeString(String, String, String)
.- Specified by:
appendString
in interfacePrimitiveIterable
-
add
public boolean add(char element)- Specified by:
add
in interfaceMutableCharCollection
-
addAll
public boolean addAll(char... source)- Specified by:
addAll
in interfaceMutableCharCollection
-
addAll
- Specified by:
addAll
in interfaceMutableCharCollection
-
remove
public boolean remove(char value)- Specified by:
remove
in interfaceMutableCharCollection
-
removeAll
- Specified by:
removeAll
in interfaceMutableCharCollection
-
removeAll
public boolean removeAll(char... source)- Specified by:
removeAll
in interfaceMutableCharCollection
-
retainAll
- Specified by:
retainAll
in interfaceMutableCharCollection
- See Also:
Collection.retainAll(Collection)
-
retainAll
public boolean retainAll(char... source)- Specified by:
retainAll
in interfaceMutableCharCollection
- See Also:
Collection.retainAll(Collection)
-
clear
public void clear()- Specified by:
clear
in interfaceMutableCharCollection
-
with
- Specified by:
with
in interfaceMutableCharCollection
- Specified by:
with
in interfaceMutableCharSet
-
without
- Specified by:
without
in interfaceMutableCharCollection
- Specified by:
without
in interfaceMutableCharSet
-
withAll
- Specified by:
withAll
in interfaceMutableCharCollection
- Specified by:
withAll
in interfaceMutableCharSet
-
withoutAll
- Specified by:
withoutAll
in interfaceMutableCharCollection
- Specified by:
withoutAll
in interfaceMutableCharSet
-
asUnmodifiable
- Specified by:
asUnmodifiable
in interfaceMutableCharCollection
- Specified by:
asUnmodifiable
in interfaceMutableCharSet
-
asSynchronized
- Specified by:
asSynchronized
in interfaceMutableCharCollection
- Specified by:
asSynchronized
in interfaceMutableCharSet
-
toImmutable
Description copied from interface:MutableCharSet
Returns an immutable copy of this set.- Specified by:
toImmutable
in interfaceCharSet
- Specified by:
toImmutable
in interfaceMutableCharCollection
- Specified by:
toImmutable
in interfaceMutableCharSet
-
charIterator
Description copied from interface:CharIterable
Returns a primitive iterator that can be used to iterate over the CharIterable in an imperative style.- Specified by:
charIterator
in interfaceCharIterable
- Specified by:
charIterator
in interfaceMutableCharCollection
-
toArray
public char[] toArray()Description copied from interface:CharIterable
Converts the CharIterable to a primitive char array.- Specified by:
toArray
in interfaceCharIterable
-
toArray
public char[] toArray(char[] array)Description copied from interface:CharIterable
Converts the CharIterable to a primitive char array. If the collection fits into the provided array it is used to store its elements and is returned from the method, otherwise a new array of the appropriate size is allocated and returned. If the iterable is empty, the target array is returned unchanged.- Specified by:
toArray
in interfaceCharIterable
-
contains
public boolean contains(char value)Description copied from interface:CharIterable
Returns true if the value is contained in the CharIterable, and false if it is not.- Specified by:
contains
in interfaceCharIterable
-
forEach
Description copied from interface:CharIterable
Applies the CharProcedure to each element in the CharIterable.- Specified by:
forEach
in interfaceCharIterable
-
each
Description copied from interface:CharIterable
A synonym for forEach.- Specified by:
each
in interfaceCharIterable
- Since:
- 7.0.
-
select
Description copied from interface:CharIterable
Returns a new CharIterable with all of the elements in the CharIterable that return true for the specified predicate.- Specified by:
select
in interfaceCharIterable
- Specified by:
select
in interfaceCharSet
- Specified by:
select
in interfaceMutableCharCollection
- Specified by:
select
in interfaceMutableCharSet
-
select
Description copied from interface:CharIterable
Same asCharIterable.select(CharPredicate)
, only the results are added to the target MutableCharCollection.- Specified by:
select
in interfaceCharIterable
- Since:
- 8.1.
-
reject
Description copied from interface:CharIterable
Returns a new CharIterable with all of the elements in the CharIterable that return false for the specified predicate.- Specified by:
reject
in interfaceCharIterable
- Specified by:
reject
in interfaceCharSet
- Specified by:
reject
in interfaceMutableCharCollection
- Specified by:
reject
in interfaceMutableCharSet
-
reject
Description copied from interface:CharIterable
Same asCharIterable.reject(CharPredicate)
, only the results are added to the target MutableCharCollection.- Specified by:
reject
in interfaceCharIterable
- Since:
- 8.1.
-
collect
Description copied from interface:CharIterable
Returns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.- Specified by:
collect
in interfaceCharIterable
- Specified by:
collect
in interfaceCharSet
- Specified by:
collect
in interfaceMutableCharCollection
- Specified by:
collect
in interfaceMutableCharSet
-
collect
public <V, R extends Collection<V>> R collect(CharToObjectFunction<? extends V> function, R target)Description copied from interface:CharIterable
Same asCharIterable.collect(CharToObjectFunction)
, only the results are added to the target Collection.- Specified by:
collect
in interfaceCharIterable
- Since:
- 8.1.
-
detectIfNone
- Specified by:
detectIfNone
in interfaceCharIterable
-
count
Description copied from interface:CharIterable
Returns a count of the number of elements in the CharIterable that return true for the specified predicate.- Specified by:
count
in interfaceCharIterable
-
anySatisfy
Description copied from interface:CharIterable
Returns true if any of the elements in the CharIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfy
in interfaceCharIterable
-
allSatisfy
Description copied from interface:CharIterable
Returns true if all of the elements in the CharIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfy
in interfaceCharIterable
-
noneSatisfy
Description copied from interface:CharIterable
Returns true if none of the elements in the CharIterable return true for the specified predicate, otherwise returns false.- Specified by:
noneSatisfy
in interfaceCharIterable
-
sum
public long sum()- Specified by:
sum
in interfaceCharIterable
-
max
public char max()- Specified by:
max
in interfaceCharIterable
-
min
public char min()- Specified by:
min
in interfaceCharIterable
-
freeze
Description copied from interface:MutableCharSet
Returns a frozen copy of this set. A frozen copy is the same thing as an immutable copy without safe-publish guarantees.- Specified by:
freeze
in interfaceCharSet
- Specified by:
freeze
in interfaceMutableCharSet
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
-
injectInto
public <T> T injectInto(T injectedValue, ObjectCharToObjectFunction<? super T,? extends T> function)- Specified by:
injectInto
in interfaceCharIterable
-
chunk
Description copied from interface:CharIterable
Partitions elements in fixed size chunks.- Specified by:
chunk
in interfaceCharIterable
- Parameters:
size
- the number of elements per chunk- Returns:
- A
RichIterable
containingCharIterable
s of sizesize
, except the last will be truncated if the elements don't divide evenly.
-
newEmpty
Creates a new empty CharHashSet.- Specified by:
newEmpty
in interfaceMutableCharCollection
- Specified by:
newEmpty
in interfaceMutableCharSet
- Since:
- 9.2.
-
compact
public void compact()Rehashes every element in the set into a new backing table of the smallest possible size and eliminating removed sentinels.
-