|
||||||||||
| 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.MultiArraySet<V>
public class MultiArraySet<V>
| Constructor Summary | |
|---|---|
MultiArraySet(int initialCapacity)
|
|
MultiArraySet(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. |
MultiSet<V> |
copy()
Returns a copy of the set. |
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 value into the set. |
void |
put(V v,
int c)
Insert the value into the set the specified number of times. |
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. |
Set<V> |
unique()
Returns a Set representing only the unique values present in this set. |
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 MultiArraySet(int initialCapacity)
public MultiArraySet(int initialCapacity,
Equality<? super V> valEq)
| Method Detail |
|---|
public MultiSet<V> copy()
MultiSetMultiSet
copy in interface AnySet<V>copy in interface MultiSet<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)
MultiSet
put in interface AnySet<V>put in interface MultiSet<V>v - the val
public void put(V v,
int c)
MultiSet
put in interface MultiSet<V>v - the valc - the number of timespublic 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()
MultiSetSet representing only the unique values present in this set.
Changes to each set should be reflected in the other, however put() operations on the unique()
set are not supported.
unique in interface AnyReadSet<V>unique in interface AnySet<V>unique in interface MultiSet<V>public int uniqueCount()
AnyReadSet
uniqueCount in interface AnyReadSet<V>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||