|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jjoost.collections.sets.base.AbstractArraySet<V>
org.jjoost.collections.sets.serial.ArraySet<V>
public class ArraySet<V>
| Constructor Summary | |
|---|---|
ArraySet(int initialCapacity)
|
|
ArraySet(int initialCapacity,
Equality<? super V> valEq)
|
|
| Method Summary | |
|---|---|
boolean |
add(V v)
Attempt to add the value to the set, returning false if the value could not be added, and true if it was. |
java.lang.Iterable<V> |
all(V v)
Returns an Iterable of all values contained in the set which are equal to the parameter, as determined by the set's
definition of equality. |
Set<V> |
copy()
Returns a copy of the set. |
V |
get(V v)
Returns the value stored in the set that is equal to the provided value, as determined by any provided Equality or
Comparator. |
java.util.List<V> |
list(V v)
Returns a List of all values contained in the set which are equal to the parameter, as determined by the set's
definition of equality. |
boolean |
permitsDuplicates()
Indicates if the set permits a value to occur more than once |
V |
put(V v)
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 |
putAll(java.lang.Iterable<V> vs)
Performs the equivalent of a put() operation for every value provided, returning an int representing the total number of
values that did not displace existing values. |
int |
size()
A convenience method returning the size of the set; this is equivalent to totalCount() or uniqueCount() |
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.AbstractArraySet |
|---|
apply, clear, clearAndReturn, contains, count, equality, first, isEmpty, iterator, putIfAbsent, remove, remove, removeAndReturn, removeAndReturn, removeAndReturnFirst, removeAndReturnFirst, shrink, totalCount |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jjoost.collections.AnySet |
|---|
clear, clearAndReturn, putIfAbsent, remove, remove, removeAndReturn, removeAndReturn, removeAndReturnFirst, removeAndReturnFirst, shrink |
| Methods inherited from interface org.jjoost.collections.AnyReadSet |
|---|
contains, count, equality, first, isEmpty, totalCount |
| Methods inherited from interface java.lang.Iterable |
|---|
iterator |
| Methods inherited from interface org.jjoost.util.Function |
|---|
apply |
| Constructor Detail |
|---|
public ArraySet(int initialCapacity)
public ArraySet(int initialCapacity,
Equality<? super V> valEq)
| Method Detail |
|---|
public Set<V> copy()
SetSet
copy in interface AnySet<V>copy in interface Set<V>public boolean add(V v)
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>v - value to insert
true if the set was modified, false otherwisepublic V put(V v)
Set
put in interface AnySet<V>put in interface Set<V>v - value to insert
public V get(V v)
SetEquality or
Comparator. Returns null if no matching item is stored in the set. Equivalent to first(key)
get in interface Set<V>v - value to find
public int size()
SettotalCount() or uniqueCount()
size in interface Set<V>public int putAll(java.lang.Iterable<V> vs)
AnySetput() operation for every value provided, returning an int representing the total number of
values that did not displace existing values. In a MultiSet this will always be equal to the number of values provided,
however in a Set it may be fewer.
putAll in interface AnySet<V>vs - values to insert
public java.lang.Iterable<V> all(V v)
AnyReadSetIterable of all values contained in the set which are equal to the parameter, as determined by the set's
definition of equality.
Changes to the set that happen prior to retrieving an Iterator from the Iterable should be reflected in the
resulting Iterator. Changes to the set once an Iterator has been obtained may or may not be reflected in
the Iterator at the discretion of the implementing class.
In a concurrent set it is acceptable for values to occur extra times if they are deleted and re-inserted in between method calls on
the Iterator.
all in interface AnyReadSet<V>v - value to look for
public java.util.List<V> list(V v)
AnyReadSetList of all values contained in the set which are equal to the parameter, as determined by the set's
definition of equality. This list should be constructed "eagerly" and should be a consistent snapshot of the values valid at some
point between the method being called and it returning.
list in interface AnyReadSet<V>v - value to look for
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 uniqueCount()
AnyReadSet
uniqueCount in interface AnyReadSet<V>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||