Class BmLongHashSet
- java.lang.Object
- 
- com._1c.g5.v8.bm.common.collections.BmLongHashSet
 
- 
- All Implemented Interfaces:
- IBmLongSet
 
 public class BmLongHashSet extends Object implements 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.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classBmLongHashSet.MapIterator- 
Nested classes/interfaces inherited from interface com._1c.g5.v8.bm.common.collections.IBmLongSetIBmLongSet.Entry
 
- 
 - 
Constructor SummaryConstructors Constructor Description BmLongHashSet()Constructs 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 SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(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.voidaddAll(Iterable<Long> values)Adds 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.Iterable<IBmLongSet.Entry>entryIterator()Gets entry iterator.booleanisEmpty()Checks whether this set is empty.IBmLongIteratoriterator()Gets the long value iteratorCollection<Long>keys()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 Detail- 
BmLongHashSetpublic BmLongHashSet() Constructs a new emptyHashMapinstance.
 - 
BmLongHashSetpublic 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.
 
 - 
BmLongHashSetpublic 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 Detail- 
addpublic void add(long key) Description copied from interface:IBmLongSetAdds the specified element.- Specified by:
- addin interface- IBmLongSet
- Parameters:
- key- the element to add.
 
 - 
addAllpublic void addAll(IBmLongSet values) Description copied from interface:IBmLongSetAdds all the values from the specified collection.- Specified by:
- addAllin interface- IBmLongSet
- Parameters:
- values- the collection of values to add.
 
 - 
addAllpublic void addAll(Iterable<Long> values) Description copied from interface:IBmLongSetAdds all the values from the specified collection.- Specified by:
- addAllin interface- IBmLongSet
- Parameters:
- values- the collection of values to add.
 
 - 
addAllpublic void addAll(long[] array) Description copied from interface:IBmLongSetAdds all the values from the specified array.- Specified by:
- addAllin interface- IBmLongSet
- Parameters:
- array- the array. May not be- null.
 
 - 
clearpublic void clear() Description copied from interface:IBmLongSetRemoves all the elements.- Specified by:
- clearin interface- IBmLongSet
- See Also:
- IBmLongSet.isEmpty(),- IBmLongSet.size()
 
 - 
containspublic boolean contains(long key) Description copied from interface:IBmLongSetChecks if the set contains the specified element.- Specified by:
- containsin interface- IBmLongSet
- Parameters:
- key- the element.
- Returns:
- trueif set contains the specified element,- falseotherwise.
 
 - 
containsAnypublic boolean containsAny(BmLongHashSet value) Checks if this set contains any element from the specified one.- Parameters:
- set- the set to run the check against, may not be- null.
- Returns:
- trueif this map contains any element from the specified one,- falseotherwise.
 
 - 
entryIteratorpublic Iterable<IBmLongSet.Entry> entryIterator() Description copied from interface:IBmLongSetGets entry iterator.- Specified by:
- entryIteratorin interface- IBmLongSet
- Returns:
- an entry iterator.
 
 - 
iteratorpublic IBmLongIterator iterator() Description copied from interface:IBmLongSetGets the long value iterator- Specified by:
- iteratorin interface- IBmLongSet
- Returns:
- The iterator of values. May not be null
 
 - 
isEmptypublic boolean isEmpty() Description copied from interface:IBmLongSetChecks whether this set is empty.- Specified by:
- isEmptyin interface- IBmLongSet
- Returns:
- trueif this set has no elements,- falseotherwise.
- See Also:
- IBmLongSet.size()
 
 - 
keyspublic Collection<Long> keys() Description copied from interface:IBmLongSetGets collection of elements.- Specified by:
- keysin interface- IBmLongSet
- Returns:
- the collection of elements.
 
 - 
removepublic boolean remove(long key) Description copied from interface:IBmLongSetRemoves the specified element.- Specified by:
- removein interface- IBmLongSet
- Parameters:
- key- the element to remove.
- Returns:
- trueif this set contained the specified element,- falseotherwise.
 
 - 
removeAllpublic void removeAll(IBmLongSet set) 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 be- null.
 
 - 
sizepublic int size() Description copied from interface:IBmLongSetReturns the number of elements in this set.- Specified by:
- sizein interface- IBmLongSet
- Returns:
- the number of elements in this set.
 
 - 
computeKeyHashprotected int computeKeyHash(long key) Computes key hash.- Parameters:
- key- The key to compute hash for.
- Returns:
- the key hash.
 
 
- 
 
-