|
||||||||||
| 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>
public abstract class AbstractArraySet<V>
| Constructor Summary | |
|---|---|
AbstractArraySet(int initialCapacity)
|
|
AbstractArraySet(int initialCapacity,
Equality<? super V> valEq)
|
|
| Method Summary | |
|---|---|
java.lang.Boolean |
apply(V v)
Returns the result of applying the function to the parameter |
int |
clear()
Removes all values from the set and return the number of values removed. |
java.util.Iterator<V> |
clearAndReturn()
Removes all values from the set and returns an Iterator over them. |
boolean |
contains(V v)
Returns a boolean indicating if the parameter occurs in the set at least once. |
int |
count(V v)
Returns an integer representing the number of occurrences of the value in the set |
Equality<? super V> |
equality()
Returns an object that represents the definition of equality used by this set |
V |
first(V v)
The first value stored in the set that is equal to the provided value, as determined by any provided Equality or
Comparator. |
boolean |
isEmpty()
Indicates if the set is empty |
java.util.Iterator<V> |
iterator()
|
V |
putIfAbsent(V v)
Inserts the value and returns null if an equal value does not already occur in the set; otherwise returns the first such
value encountered |
int |
remove(V value)
Removes all occurrences of values equal to the parameter from the set, as determined by the set's definition of equality and returns the number of values that were removed from the set. |
int |
remove(V v,
int atMost)
Removes at most the prescribed number of values equal to the parameter from the set; which values are removed is implementation specific, and may be arbitrary. |
java.lang.Iterable<V> |
removeAndReturn(V value)
Removes all occurrences of values equal to the parameter and returns an Iterable of the values removed. |
java.lang.Iterable<V> |
removeAndReturn(V v,
int atMost)
Removes at most the prescribed number of values equal to the parameter from the set and returns them to the user; which values are removed is implementation specific, and may be arbitrary. |
V |
removeAndReturnFirst(V value)
Removes all occurrences of values equal to the parameter from the set, as determined by the set's definition of equality, and returns the first value encountered or null if none. |
V |
removeAndReturnFirst(V v,
int atMost)
Removes at most the prescribed number of values equal to the parameter from the set and returns the first one encountered to the user, or null if none; which values are removed is implementation specific, and may be arbitrary. |
void |
shrink()
This method attempts to minimise the resource utilisation of the set. |
int |
totalCount()
Returns the total number of values (including duplicates) in the set |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jjoost.collections.AnySet |
|---|
add, copy, put, putAll, unique |
| Methods inherited from interface org.jjoost.collections.AnyReadSet |
|---|
all, list, permitsDuplicates, uniqueCount |
| Constructor Detail |
|---|
public AbstractArraySet(int initialCapacity)
public AbstractArraySet(int initialCapacity,
Equality<? super V> valEq)
| Method Detail |
|---|
public int clear()
AnySet
clear in interface AnySet<V>public java.util.Iterator<V> clearAndReturn()
AnySetIterator over them. This Iterator
must be exactly equal to the set of values removed from the set by the action, however this set of values
may not necessarily be determined, or the clear() completed, until the Iterator
has been exhausted.
clearAndReturn in interface AnySet<V>public V putIfAbsent(V v)
AnySetnull if an equal value does not already occur in the set; otherwise returns the first such
value encountered
putIfAbsent in interface AnySet<V>v - value to insert
public int remove(V v,
int atMost)
AnySet
remove in interface AnySet<V>v - remove equal toatMost - remove at most
public java.lang.Iterable<V> removeAndReturn(V v,
int atMost)
AnySet
removeAndReturn in interface AnySet<V>v - the valueatMost - remove at most
public V removeAndReturnFirst(V v,
int atMost)
AnySet
removeAndReturnFirst in interface AnySet<V>v - removeatMost - remove at most
public int remove(V value)
AnySetremove(value, Integer.MAX_VALUE).
remove in interface AnySet<V>value - remove equal to
public java.lang.Iterable<V> removeAndReturn(V value)
AnySetIterable of the values removed. Equivalent to
removeAndReturn(value, Integer.MAX_VALUE).
removeAndReturn in interface AnySet<V>value - remove equal to
public V removeAndReturnFirst(V value)
AnySetremoveAndReturnFirst(value, Integer.MAX_VALUE).
removeAndReturnFirst in interface AnySet<V>value - remove
public void shrink()
AnySet
shrink in interface AnySet<V>public boolean contains(V v)
AnyReadSetboolean indicating if the parameter occurs in the set at least once.
contains in interface AnyReadSet<V>v - value to look for
true, if presentpublic int count(V v)
AnyReadSet
count in interface AnyReadSet<V>v - value to look for
public V first(V v)
AnyReadSetEquality or
Comparator. Returns null if no matching item is stored in the set.
first in interface AnyReadSet<V>v - value to look for
public boolean isEmpty()
AnyReadSet
isEmpty in interface AnyReadSet<V>public int totalCount()
AnyReadSet
totalCount in interface AnyReadSet<V>public java.util.Iterator<V> iterator()
iterator in interface java.lang.Iterable<V>public java.lang.Boolean apply(V v)
Function
apply in interface Function<V,java.lang.Boolean>v - something of type domain
public Equality<? super V> equality()
AnyReadSet
equality in interface AnyReadSet<V>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||