Class YLongSet
java.lang.Object
de.hybris.platform.util.collections.fast.YLongSet
Set that can hold long primitives.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(long value) Adds element to the set.booleancontains(long value) Checks if given elements is in the set.booleaninthashCode()booleanisEmpty()Checks if the set is empty.booleanremove(long value) Removes given element from the set.intsize()Returns number of elements in the set.long[]toArray()Gets all elements from the set as an array.
-
Constructor Details
-
YLongSet
public YLongSet()Creates an empty set. -
YLongSet
public YLongSet(int initialCapacity) Creates an empty set with preallocated initial space for elements.- Parameters:
initialCapacity- initial capacity of the set
-
-
Method Details
-
size
public int size()Returns number of elements in the set.- Returns:
- number of elements in the set
-
add
public boolean add(long value) Adds element to the set. Can be invoked for the same value multiple times.- Parameters:
value- value to add- Returns:
- returns
trueif this set changed otherwisefalseis returned
-
remove
public boolean remove(long value) Removes given element from the set. Can be invoked for values that don't exist in the set.- Parameters:
value- value to remove- Returns:
- returns
trueif this set changed otherwisefalseis returned
-
isEmpty
public boolean isEmpty()Checks if the set is empty.- Returns:
trueif the set is empty,falseif set contains one or more elements
-
toArray
public long[] toArray()Gets all elements from the set as an array. The order of elements in the array is unspecified.- Returns:
- array with all elements from this set
-
contains
public boolean contains(long value) Checks if given elements is in the set.- Parameters:
value- value to test- Returns:
trueif value is in the set orfalseotherwise
-
equals
-
hashCode
public int hashCode()
-