Class BmLongHashSet
java.lang.Object
com._1c.g5.v8.bm.common.collections.BmLongHashSet
- All Implemented Interfaces:
IBmLongSet
This code is adoption of 'HashMap' from Apache Harmony refactored to support primitive long keys.
This implementation doesn't support removal of elements via itearator.
This implementation doesn't support removal of elements via itearator.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com._1c.g5.v8.bm.common.collections.IBmLongSet
IBmLongSet.Entry -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new emptyHashMapinstance.BmLongHashSet(int capacity) Constructs a newHashMapinstance with the specified capacity.BmLongHashSet(int capacity, float loadFactor) Constructs a newHashMapinstance with the specified capacity and load factor. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(long key) Adds the specified element.voidaddAll(long[] array) Adds all the values from the specified array.voidaddAll(IBmLongSet values) Adds all the values from the specified collection.voidAdds all the values from the specified collection.voidclear()Removes all the elements.protected intcomputeKeyHash(long key) Computes key hash.booleancontains(long key) Checks if the set contains the specified element.booleancontainsAny(BmLongHashSet value) Checks if this set contains any element from the specified one.Gets entry iterator.booleanisEmpty()Checks whether this set is empty.iterator()Gets the long value iteratorkeys()Gets collection of elements.booleanremove(long key) Removes the specified element.voidremoveAll(IBmLongSet set) Removes from this set all of its elements that are contained in the specified set.intsize()Returns the number of elements in this set.
-
Constructor Details
-
BmLongHashSet
public BmLongHashSet()Constructs a new emptyHashMapinstance. -
BmLongHashSet
public BmLongHashSet(int capacity) Constructs a newHashMapinstance with the specified capacity.- Parameters:
capacity- the initial capacity of this hash map.- Throws:
IllegalArgumentException- when the capacity is less than zero.
-
BmLongHashSet
public BmLongHashSet(int capacity, float loadFactor) Constructs a newHashMapinstance with the specified capacity and load factor.- Parameters:
capacity- the initial capacity of this hash map.loadFactor- the initial load factor.- Throws:
IllegalArgumentException- when the capacity is less than zero or the load factor is less or equal to zero.
-
-
Method Details
-
add
public void add(long key) Description copied from interface:IBmLongSetAdds the specified element.- Specified by:
addin interfaceIBmLongSet- Parameters:
key- the element to add.
-
addAll
Description copied from interface:IBmLongSetAdds all the values from the specified collection.- Specified by:
addAllin interfaceIBmLongSet- Parameters:
values- the collection of values to add.
-
addAll
Description copied from interface:IBmLongSetAdds all the values from the specified collection.- Specified by:
addAllin interfaceIBmLongSet- Parameters:
values- the collection of values to add.
-
addAll
public void addAll(long[] array) Description copied from interface:IBmLongSetAdds all the values from the specified array.- Specified by:
addAllin interfaceIBmLongSet- Parameters:
array- the array. May not benull.
-
clear
public void clear()Description copied from interface:IBmLongSetRemoves all the elements.- Specified by:
clearin interfaceIBmLongSet- See Also:
-
contains
public boolean contains(long key) Description copied from interface:IBmLongSetChecks if the set contains the specified element.- Specified by:
containsin interfaceIBmLongSet- Parameters:
key- the element.- Returns:
trueif set contains the specified element,falseotherwise.
-
containsAny
Checks if this set contains any element from the specified one.- Parameters:
set- the set to run the check against, may not benull.- Returns:
trueif this map contains any element from the specified one,falseotherwise.
-
entryIterator
Description copied from interface:IBmLongSetGets entry iterator.- Specified by:
entryIteratorin interfaceIBmLongSet- Returns:
- an entry iterator.
-
iterator
Description copied from interface:IBmLongSetGets the long value iterator- Specified by:
iteratorin interfaceIBmLongSet- Returns:
- The iterator of values. May not be
null
-
isEmpty
public boolean isEmpty()Description copied from interface:IBmLongSetChecks whether this set is empty.- Specified by:
isEmptyin interfaceIBmLongSet- Returns:
trueif this set has no elements,falseotherwise.- See Also:
-
keys
Description copied from interface:IBmLongSetGets collection of elements.- Specified by:
keysin interfaceIBmLongSet- Returns:
- the collection of elements.
-
remove
public boolean remove(long key) Description copied from interface:IBmLongSetRemoves the specified element.- Specified by:
removein interfaceIBmLongSet- Parameters:
key- the element to remove.- Returns:
trueif this set contained the specified element,falseotherwise.
-
removeAll
Removes from this set all of its elements that are contained in the specified set.- Parameters:
set- The set containing elements to be removed from this set, may not benull.
-
size
public int size()Description copied from interface:IBmLongSetReturns the number of elements in this set.- Specified by:
sizein interfaceIBmLongSet- Returns:
- the number of elements in this set.
-
computeKeyHash
protected int computeKeyHash(long key) Computes key hash.- Parameters:
key- The key to compute hash for.- Returns:
- the key hash.
-