Class LongHashSet
java.lang.Object
org.eclipse.collections.impl.primitive.AbstractLongIterable
org.eclipse.collections.impl.set.primitive.AbstractLongSet
org.eclipse.collections.impl.set.mutable.primitive.LongHashSet
- All Implemented Interfaces:
Externalizable,Serializable,MutableLongCollection,LongIterable,PrimitiveIterable,LongSet,MutableLongSet
public class LongHashSet extends AbstractLongSet implements MutableLongSet, Externalizable
This file was automatically generated from template file primitiveHashSet.stg.
- Since:
- 3.0.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description LongHashSet()LongHashSet(int initialCapacity)LongHashSet(long... elements)LongHashSet(LongHashSet set) -
Method Summary
Modifier and Type Method Description booleanadd(long element)booleanaddAll(long... source)booleanaddAll(LongIterable source)booleanallSatisfy(LongPredicate predicate)Returns true if all of the elements in the LongIterable return true for the specified predicate, otherwise returns false.booleananySatisfy(LongPredicate predicate)Returns true if any of the elements in the LongIterable return true for the specified predicate, otherwise returns false.voidappendString(Appendable appendable, String start, String separator, String end)Prints a string representation of this collection onto the givenAppendable.MutableLongSetasSynchronized()MutableLongSetasUnmodifiable()RichIterable<LongIterable>chunk(int size)Partitions elements in fixed size chunks.voidclear()<V> MutableSet<V>collect(LongToObjectFunction<? 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(LongToObjectFunction<? extends V> function, R target)Same asLongIterable.collect(LongToObjectFunction), only the results are added to the target Collection.voidcompact()Rehashes every element in the set into a new backing table of the smallest possible size and eliminating removed sentinels.booleancontains(long value)Returns true if the value is contained in the LongIterable, and false if it is not.intcount(LongPredicate predicate)Returns a count of the number of elements in the LongIterable that return true for the specified predicate.longdetectIfNone(LongPredicate predicate, long ifNone)voideach(LongProcedure procedure)A synonym for forEach.voidforEach(LongProcedure procedure)Applies the LongProcedure to each element in the LongIterable.LongSetfreeze()Returns a frozen copy of this set.inthashCode()Follows the same general contract asSet.hashCode().<T> TinjectInto(T injectedValue, ObjectLongToObjectFunction<? super T,? extends T> function)MutableLongIteratorlongIterator()Returns a primitive iterator that can be used to iterate over the LongIterable in an imperative style.longmax()longmin()LongHashSetnewEmpty()Creates a new empty LongHashSet.static LongHashSetnewSet(LongIterable source)static LongHashSetnewSetWith(long... source)booleannoneSatisfy(LongPredicate predicate)Returns true if none of the elements in the LongIterable return true for the specified predicate, otherwise returns false.voidreadExternal(ObjectInput in)LongHashSetreject(LongPredicate predicate)Returns a new LongIterable with all of the elements in the LongIterable that return false for the specified predicate.<R extends MutableLongCollection>
Rreject(LongPredicate predicate, R target)Same asLongIterable.reject(LongPredicate), only the results are added to the target MutableLongCollection.booleanremove(long value)booleanremoveAll(long... source)booleanremoveAll(LongIterable source)booleanretainAll(long... source)booleanretainAll(LongIterable source)LongHashSetselect(LongPredicate predicate)Returns a new LongIterable with all of the elements in the LongIterable that return true for the specified predicate.<R extends MutableLongCollection>
Rselect(LongPredicate predicate, R target)Same asLongIterable.select(LongPredicate), only the results are added to the target MutableLongCollection.intsize()Returns the number of items in this iterable.longsum()long[]toArray()Converts the LongIterable to a primitive long array.long[]toArray(long[] array)Converts the LongIterable to a primitive long array.ImmutableLongSettoImmutable()Returns an immutable copy of this set.LongHashSetwith(long element)LongHashSetwithAll(LongIterable elements)LongHashSetwithout(long element)LongHashSetwithoutAll(LongIterable elements)voidwriteExternal(ObjectOutput out)Methods inherited from class org.eclipse.collections.impl.primitive.AbstractLongIterable
asLazy, average, containsAll, containsAll, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toStringMethods inherited from interface org.eclipse.collections.api.LongIterable
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, toSortedListMethods inherited from interface org.eclipse.collections.api.collection.primitive.MutableLongCollection
removeIfMethods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, toString
-
Constructor Details
-
LongHashSet
public LongHashSet() -
LongHashSet
public LongHashSet(int initialCapacity) -
LongHashSet
public LongHashSet(long... elements) -
LongHashSet
-
-
Method Details
-
newSet
-
newSetWith
-
hashCode
public int hashCode()Description copied from interface:LongSetFollows the same general contract asSet.hashCode().- Specified by:
hashCodein interfaceLongSet- Specified by:
hashCodein classAbstractLongSet
-
size
public int size()Description copied from interface:PrimitiveIterableReturns the number of items in this iterable.- Specified by:
sizein interfacePrimitiveIterable
-
appendString
Description copied from interface:PrimitiveIterablePrints a string representation of this collection onto the givenAppendable. Prints the string returned byPrimitiveIterable.makeString(String, String, String).- Specified by:
appendStringin interfacePrimitiveIterable
-
add
public boolean add(long element)- Specified by:
addin interfaceMutableLongCollection
-
addAll
public boolean addAll(long... source)- Specified by:
addAllin interfaceMutableLongCollection
-
addAll
- Specified by:
addAllin interfaceMutableLongCollection
-
remove
public boolean remove(long value)- Specified by:
removein interfaceMutableLongCollection
-
removeAll
- Specified by:
removeAllin interfaceMutableLongCollection
-
removeAll
public boolean removeAll(long... source)- Specified by:
removeAllin interfaceMutableLongCollection
-
retainAll
- Specified by:
retainAllin interfaceMutableLongCollection- See Also:
Collection.retainAll(Collection)
-
retainAll
public boolean retainAll(long... source)- Specified by:
retainAllin interfaceMutableLongCollection- See Also:
Collection.retainAll(Collection)
-
clear
public void clear()- Specified by:
clearin interfaceMutableLongCollection
-
with
- Specified by:
within interfaceMutableLongCollection- Specified by:
within interfaceMutableLongSet
-
without
- Specified by:
withoutin interfaceMutableLongCollection- Specified by:
withoutin interfaceMutableLongSet
-
withAll
- Specified by:
withAllin interfaceMutableLongCollection- Specified by:
withAllin interfaceMutableLongSet
-
withoutAll
- Specified by:
withoutAllin interfaceMutableLongCollection- Specified by:
withoutAllin interfaceMutableLongSet
-
asUnmodifiable
- Specified by:
asUnmodifiablein interfaceMutableLongCollection- Specified by:
asUnmodifiablein interfaceMutableLongSet
-
asSynchronized
- Specified by:
asSynchronizedin interfaceMutableLongCollection- Specified by:
asSynchronizedin interfaceMutableLongSet
-
toImmutable
Description copied from interface:MutableLongSetReturns an immutable copy of this set.- Specified by:
toImmutablein interfaceLongSet- Specified by:
toImmutablein interfaceMutableLongCollection- Specified by:
toImmutablein interfaceMutableLongSet
-
longIterator
Description copied from interface:LongIterableReturns a primitive iterator that can be used to iterate over the LongIterable in an imperative style.- Specified by:
longIteratorin interfaceLongIterable- Specified by:
longIteratorin interfaceMutableLongCollection
-
toArray
public long[] toArray()Description copied from interface:LongIterableConverts the LongIterable to a primitive long array.- Specified by:
toArrayin interfaceLongIterable
-
toArray
public long[] toArray(long[] array)Description copied from interface:LongIterableConverts the LongIterable to a primitive long 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:
toArrayin interfaceLongIterable
-
contains
public boolean contains(long value)Description copied from interface:LongIterableReturns true if the value is contained in the LongIterable, and false if it is not.- Specified by:
containsin interfaceLongIterable
-
forEach
Description copied from interface:LongIterableApplies the LongProcedure to each element in the LongIterable.- Specified by:
forEachin interfaceLongIterable
-
each
Description copied from interface:LongIterableA synonym for forEach.- Specified by:
eachin interfaceLongIterable- Since:
- 7.0.
-
select
Description copied from interface:LongIterableReturns a new LongIterable with all of the elements in the LongIterable that return true for the specified predicate.- Specified by:
selectin interfaceLongIterable- Specified by:
selectin interfaceLongSet- Specified by:
selectin interfaceMutableLongCollection- Specified by:
selectin interfaceMutableLongSet
-
select
Description copied from interface:LongIterableSame asLongIterable.select(LongPredicate), only the results are added to the target MutableLongCollection.- Specified by:
selectin interfaceLongIterable- Since:
- 8.1.
-
reject
Description copied from interface:LongIterableReturns a new LongIterable with all of the elements in the LongIterable that return false for the specified predicate.- Specified by:
rejectin interfaceLongIterable- Specified by:
rejectin interfaceLongSet- Specified by:
rejectin interfaceMutableLongCollection- Specified by:
rejectin interfaceMutableLongSet
-
reject
Description copied from interface:LongIterableSame asLongIterable.reject(LongPredicate), only the results are added to the target MutableLongCollection.- Specified by:
rejectin interfaceLongIterable- Since:
- 8.1.
-
collect
Description copied from interface:LongIterableReturns 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:
collectin interfaceLongIterable- Specified by:
collectin interfaceLongSet- Specified by:
collectin interfaceMutableLongCollection- Specified by:
collectin interfaceMutableLongSet
-
collect
public <V, R extends Collection<V>> R collect(LongToObjectFunction<? extends V> function, R target)Description copied from interface:LongIterableSame asLongIterable.collect(LongToObjectFunction), only the results are added to the target Collection.- Specified by:
collectin interfaceLongIterable- Since:
- 8.1.
-
detectIfNone
- Specified by:
detectIfNonein interfaceLongIterable
-
count
Description copied from interface:LongIterableReturns a count of the number of elements in the LongIterable that return true for the specified predicate.- Specified by:
countin interfaceLongIterable
-
anySatisfy
Description copied from interface:LongIterableReturns true if any of the elements in the LongIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfyin interfaceLongIterable
-
allSatisfy
Description copied from interface:LongIterableReturns true if all of the elements in the LongIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfyin interfaceLongIterable
-
noneSatisfy
Description copied from interface:LongIterableReturns true if none of the elements in the LongIterable return true for the specified predicate, otherwise returns false.- Specified by:
noneSatisfyin interfaceLongIterable
-
sum
public long sum()- Specified by:
sumin interfaceLongIterable
-
max
public long max()- Specified by:
maxin interfaceLongIterable
-
min
public long min()- Specified by:
minin interfaceLongIterable
-
freeze
Description copied from interface:MutableLongSetReturns a frozen copy of this set. A frozen copy is the same thing as an immutable copy without safe-publish guarantees.- Specified by:
freezein interfaceLongSet- Specified by:
freezein interfaceMutableLongSet
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-
injectInto
public <T> T injectInto(T injectedValue, ObjectLongToObjectFunction<? super T,? extends T> function)- Specified by:
injectIntoin interfaceLongIterable
-
chunk
Description copied from interface:LongIterablePartitions elements in fixed size chunks.- Specified by:
chunkin interfaceLongIterable- Parameters:
size- the number of elements per chunk- Returns:
- A
RichIterablecontainingLongIterables of sizesize, except the last will be truncated if the elements don't divide evenly.
-
newEmpty
Creates a new empty LongHashSet.- Specified by:
newEmptyin interfaceMutableLongCollection- Specified by:
newEmptyin interfaceMutableLongSet- 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.
-