|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jjoost.collections.sets.base.AbstractSet<V>
org.jjoost.collections.sets.base.AbstractHashSet<V,N>
org.jjoost.collections.sets.base.HashSet<V,N>
public class HashSet<V,N extends HashNode<N> & Value<V>>
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.jjoost.collections.sets.base.AbstractHashSet |
|---|
AbstractHashSet.LockFreeHashSetNode<V>, AbstractHashSet.LockFreeHashSetNodeFactory<V>, AbstractHashSet.LockFreeLinkedHashSetNode<V>, AbstractHashSet.LockFreeLinkedHashSetNodeFactory<V>, AbstractHashSet.SerialHashSetNode<V>, AbstractHashSet.SerialHashSetNodeFactory<V>, AbstractHashSet.SerialLinkedHashSetNode<V>, AbstractHashSet.SerialLinkedHashSetNodeFactory<V> |
| Constructor Summary | |
|---|---|
HashSet(Rehasher rehasher,
Equality<? super V> equality,
HashNodeFactory<V,N> nodeFactory,
HashStore<N> table)
|
|
| Method Summary | |
|---|---|
boolean |
add(V val)
Attempt to add the value to the set, returning false if the value could not be added, and true if it was. |
HashSet<V,N> |
copy()
Returns a copy of the set. |
V |
get(V key)
Returns the value stored in the set that is equal to the provided value, as determined by any provided Equality or
Comparator. |
boolean |
permitsDuplicates()
Indicates if the set permits a value to occur more than once |
V |
put(V val)
Insert the parameter into the set, removing and returning any value equal to the parameter that was already present, as determined by the set's definition of equality. |
int |
size()
A convenience method returning the size of the set; this is equivalent to totalCount() or uniqueCount() |
java.lang.String |
toString()
|
Set<V> |
unique()
Returns this |
int |
uniqueCount()
Returns the number of unique values in the set |
| Methods inherited from class org.jjoost.collections.sets.base.AbstractHashSet |
|---|
all, apply, capacity, clear, clearAndReturn, contains, count, equality, first, isEmpty, iterator, list, lockFreeLinkedNodeFactory, lockFreeNodeFactory, putAll, putIfAbsent, remove, remove, removeAndReturn, removeAndReturn, removeAndReturnFirst, removeAndReturnFirst, resize, serialLinkedNodeFactory, serialNodeFactory, shrink, totalCount |
| Methods inherited from class org.jjoost.collections.sets.base.AbstractSet |
|---|
equals, equals |
| Methods inherited from class java.lang.Object |
|---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.jjoost.collections.AnySet |
|---|
clear, clearAndReturn, putAll, putIfAbsent, remove, remove, removeAndReturn, removeAndReturn, removeAndReturnFirst, removeAndReturnFirst, shrink |
| Methods inherited from interface org.jjoost.collections.AnyReadSet |
|---|
all, contains, count, equality, first, isEmpty, list, totalCount |
| Methods inherited from interface java.lang.Iterable |
|---|
iterator |
| Methods inherited from interface org.jjoost.util.Function |
|---|
apply |
| Constructor Detail |
|---|
public HashSet(Rehasher rehasher,
Equality<? super V> equality,
HashNodeFactory<V,N> nodeFactory,
HashStore<N> table)
| Method Detail |
|---|
public boolean add(V val)
AnySetfalse if the value could not be added, and true if it was.
In a MultiSet the return value will always be true, however in a Set it will be
false if a value equal to the one provided (as determined by the set's definition of equality) was already present. For
values inequal to null, this is equivalent to put(value) == null
add in interface AnySet<V>val - value to insert
true if the set was modified, false otherwisepublic V put(V val)
Set
put in interface AnySet<V>put in interface Set<V>val - value to insert
public V get(V key)
SetEquality or
Comparator. Returns null if no matching item is stored in the set. Equivalent to first(key)
get in interface Set<V>key - value to find
public HashSet<V,N> copy()
SetSet
copy in interface AnySet<V>copy in interface Set<V>public boolean permitsDuplicates()
AnyReadSet
permitsDuplicates in interface AnyReadSet<V>public Set<V> unique()
Setthis
unique in interface AnyReadSet<V>unique in interface AnySet<V>unique in interface Set<V>thispublic int size()
SettotalCount() or uniqueCount()
size in interface Set<V>public int uniqueCount()
AnyReadSet
uniqueCount in interface AnyReadSet<V>public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||