Javolution 6.0.0 java
|
Public Member Functions | |
SetView (SetService< E > target) | |
abstract int | size () |
abstract boolean | contains (Object o) |
abstract boolean | remove (Object o) |
SetService< E > | threadSafe () |
abstract boolean | add (E element) |
boolean | addAll (Collection<? extends E > c) |
FastCollection< E > | addAll (E... elements) |
FastCollection< E > | addAll (FastCollection<? extends E > that) |
void | clear () |
CollectionView< E > | clone () |
abstract Equality<? super E > | comparator () |
boolean | containsAll (Collection<?> c) |
boolean | equals (Object o) |
int | hashCode () |
boolean | isEmpty () |
abstract Iterator< E > | iterator () |
void | perform (Consumer< CollectionService< E >> action, CollectionService< E > view) |
void | perform (Consumer<? extends Collection< E >> action) |
void | perform (Consumer< T > action, T part) |
boolean | removeAll (Collection<?> c) |
boolean | retainAll (Collection<?> c) |
CollectionService< E >[] | split (int n) |
Object[] | toArray () |
void | update (Consumer< CollectionService< E >> action, CollectionService< E > view) |
void | update (Consumer<? extends Collection< E >> action) |
void | update (Consumer< T > action, T part) |
FastCollection< E > | atomic () |
FastCollection< E > | shared () |
FastCollection< E > | parallel () |
FastCollection< E > | sequential () |
FastCollection< E > | unmodifiable () |
FastCollection< E > | filtered (Predicate<? super E > filter) |
FastCollection< E > | sorted () |
FastCollection< E > | sorted (Comparator<? super E > cmp) |
FastCollection< E > | reversed () |
FastCollection< E > | distinct () |
void | forEach (final Consumer<? super E > consumer) |
boolean | removeIf (final Predicate<? super E > filter) |
E | reduce (Reducer< E > reducer) |
E | min () |
E | max () |
String | toString () |
Protected Member Functions | |
SetService< E > | target () |
CollectionService< E > | service () |
Static Protected Member Functions | |
static< E > CollectionService< E > | serviceOf (FastCollection< E > collection) |
Package Functions | |
public< T > T[] | toArray (T[] a) |
public< R > FastCollection< R > | mapped (Function<? super E, ? extends R > function) |
public< T extends E > T | any (Class< T > type) |
public< T extends Collection< E > > Immutable< T > | toImmutable () |
Static Private Attributes | |
static final long | serialVersionUID = 0x600L |
Set view implementation; can be used as root class for implementations if target is
.
Definition at line 18 of file SetView.java.
javolution.util.internal.set.SetView< E >.SetView | ( | SetService< E > | target | ) |
The view constructor or root class constructor if target is
.
Definition at line 25 of file SetView.java.
|
abstractinherited |
Adds the specified element to this collection
Reimplemented from javolution.util.FastCollection< E >.
Reimplemented in javolution.util.internal.collection.FilteredCollectionImpl< E >, javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.collection.DistinctCollectionImpl< E >, javolution.util.internal.table.FastTableImpl< E >, javolution.util.internal.collection.AtomicCollectionImpl< E >, javolution.util.internal.table.SubTableImpl< E >, javolution.util.internal.collection.UnmodifiableCollectionImpl< E >, javolution.util.internal.table.sorted.FastSortedTableImpl< E >, javolution.util.internal.table.UnmodifiableTableImpl< E >, javolution.util.internal.collection.SortedCollectionImpl< E >, javolution.util.internal.set.sorted.SubSortedSetImpl< E >, javolution.util.internal.table.ReversedTableImpl< E >, javolution.util.internal.collection.ReversedCollectionImpl< E >, javolution.util.internal.collection.ParallelCollectionImpl< E >, and javolution.util.internal.collection.SequentialCollectionImpl< E >.
Referenced by javolution.util.internal.collection.CollectionView< R >.addAll().
|
inherited |
Adds all the specified elements to this collection.
Reimplemented from javolution.util.FastCollection< E >.
Reimplemented in javolution.util.internal.collection.SharedCollectionImpl< E >, and javolution.util.internal.collection.AtomicCollectionImpl< E >.
Definition at line 46 of file CollectionView.java.
|
inherited |
Returns this collection with the specified element added.
elements | the elements to be added. |
Reimplemented in javolution.util.FastTable< E >, javolution.util.FastSortedSet< E >, javolution.util.FastSet< E >, and javolution.util.FastSortedTable< E >.
Definition at line 552 of file FastCollection.java.
|
inherited |
Returns this collection with the specified collection's elements added in sequence.
Reimplemented in javolution.util.FastTable< E >, javolution.util.FastSortedSet< E >, javolution.util.FastSet< E >, and javolution.util.FastSortedTable< E >.
Definition at line 564 of file FastCollection.java.
|
packageinherited |
Returns any non-null element of the specified type (convenience method).
type | the element type searched for. |
Definition at line 515 of file FastCollection.java.
References javolution.util.function.Reducers.any().
|
inherited |
Returns an atomic view over this collection. All operations that write or access multiple elements in the collection (such as addAll(), retainAll()) are atomic. Iterators on atomic collections are thread-safe (no ConcurrentModificationException possible).
Reimplemented in javolution.util.FastTable< E >, javolution.util.FastSet< E >, javolution.util.FastSortedTable< E >, and javolution.util.FastSortedSet< E >.
Definition at line 187 of file FastCollection.java.
|
inherited |
Removes all elements from this collection.
Reimplemented from javolution.util.FastCollection< E >.
Reimplemented in javolution.util.internal.table.FastTableImpl< E >, javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.bitset.BitSetServiceImpl, javolution.util.internal.collection.AtomicCollectionImpl< E >, javolution.util.internal.collection.SortedCollectionImpl< E >, javolution.util.internal.collection.DistinctCollectionImpl< E >, javolution.util.internal.table.SubTableImpl< E >, javolution.util.internal.collection.ReversedCollectionImpl< E >, javolution.util.internal.table.ReversedTableImpl< E >, javolution.util.internal.table.TableView< E >, javolution.util.internal.collection.UnmodifiableCollectionImpl< E >, javolution.util.internal.table.UnmodifiableTableImpl< E >, javolution.util.internal.collection.ParallelCollectionImpl< E >, and javolution.util.internal.collection.SequentialCollectionImpl< E >.
Definition at line 56 of file CollectionView.java.
|
inherited |
Returns a copy of this collection; updates of the copy should not impact the original.
Implements javolution.util.service.CollectionService< E >.
Reimplemented in javolution.util.internal.table.FastTableImpl< E >, javolution.util.internal.collection.SharedCollectionImpl< E >, and javolution.util.internal.collection.AtomicCollectionImpl< E >.
Definition at line 66 of file CollectionView.java.
Referenced by javolution.util.internal.collection.CollectionView< R >.clone(), and javolution.util.internal.collection.CollectionView< R >.split().
|
abstractinherited |
Returns the comparator uses by this collection for equality and/or ordering if this collection is sorted.
Reimplemented from javolution.util.FastCollection< E >.
Reimplemented in javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.bitset.BitSetServiceImpl, javolution.util.internal.table.FastTableImpl< E >, javolution.util.internal.table.SubTableImpl< E >, javolution.util.internal.collection.AtomicCollectionImpl< E >, javolution.util.internal.collection.SortedCollectionImpl< E >, javolution.util.internal.set.sorted.SubSortedSetImpl< E >, javolution.util.internal.collection.FilteredCollectionImpl< E >, javolution.util.internal.table.UnmodifiableTableImpl< E >, javolution.util.internal.collection.DistinctCollectionImpl< E >, javolution.util.internal.map.MapView< K, V >.EntrySet, javolution.util.internal.table.ReversedTableImpl< E >, javolution.util.internal.collection.ReversedCollectionImpl< E >, javolution.util.internal.collection.UnmodifiableCollectionImpl< E >, javolution.util.internal.collection.ParallelCollectionImpl< E >, and javolution.util.internal.collection.SequentialCollectionImpl< E >.
Referenced by javolution.util.internal.collection.CollectionView< R >.contains(), javolution.util.internal.collection.CollectionView< R >.equals(), javolution.util.internal.collection.CollectionView< R >.hashCode(), javolution.util.internal.table.sorted.SortedTableView< E >.indexOf(), javolution.util.internal.table.TableView< E >.indexOf(), javolution.util.internal.table.sorted.SortedTableView< E >.lastIndexOf(), javolution.util.internal.table.TableView< E >.lastIndexOf(), and javolution.util.internal.collection.CollectionView< R >.remove().
|
abstract |
Indicates if this collection contains the specified element.
Reimplemented from javolution.util.internal.collection.CollectionView< E >.
Reimplemented in javolution.util.internal.set.sorted.SubSortedSetImpl< E >, javolution.util.internal.map.MapView< K, V >.EntrySet, and javolution.util.internal.bitset.BitSetServiceImpl.
|
inherited |
Indicates if this collection contains all the specified elements.
Reimplemented from javolution.util.FastCollection< E >.
Reimplemented in javolution.util.internal.collection.SharedCollectionImpl< E >, and javolution.util.internal.collection.AtomicCollectionImpl< E >.
Definition at line 93 of file CollectionView.java.
Referenced by javolution.util.internal.collection.CollectionView< R >.equals().
|
inherited |
Returns a view exposing only distinct elements (it does not iterate twice over the same elements). Adding elements already in the collection through this view has no effect. If this collection is initially empty, using a distinct view to add new elements ensures that this collection has no duplicate.
Definition at line 293 of file FastCollection.java.
|
inherited |
Compares the specified object with this collection for equality. This method follows the Collection#equals(Object) specification if this collection comparator is Equalities#STANDARD (default). Otherwise, only collections using the same comparator can be considered equals.
obj | the object to be compared for equality with this collection |
true
if both collections are considered equals; false
otherwise. Reimplemented from javolution.util.FastCollection< E >.
Reimplemented in javolution.util.internal.collection.SharedCollectionImpl< E >, and javolution.util.internal.collection.AtomicCollectionImpl< E >.
Definition at line 102 of file CollectionView.java.
Referenced by javolution.util.internal.collection.CollectionView< R >.equals().
|
inherited |
Returns a view exposing only the elements matching the specified filter. Adding elements not matching the specified filter has no effect. If this collection is initially empty, using a filtered view to add new elements ensure that this collection has only elements satisfying the filter predicate.
Reimplemented in javolution.util.FastSet< E >.
Definition at line 250 of file FastCollection.java.
|
inherited |
Iterates over all this collection elements applying the specified consumer (convenience method). Iterations are performed concurrently if the collection is parallel.
consumer | the functional consumer applied to the collection elements. |
Definition at line 346 of file FastCollection.java.
References javolution.util.function.Consumer< T >.accept().
|
inherited |
Returns the hash code of this collection. This method follows the Collection#hashCode() specification if this collection comparator is Equalities#STANDARD.
Reimplemented from javolution.util.FastCollection< E >.
Reimplemented in javolution.util.internal.collection.SharedCollectionImpl< E >, and javolution.util.internal.collection.AtomicCollectionImpl< E >.
Definition at line 135 of file CollectionView.java.
|
inherited |
Indicates if this collection is empty.
Reimplemented from javolution.util.FastCollection< E >.
Reimplemented in javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.collection.AtomicCollectionImpl< E >, javolution.util.internal.set.sorted.SubSortedSetImpl< E >, javolution.util.internal.table.TableView< E >, javolution.util.internal.collection.SortedCollectionImpl< E >, javolution.util.internal.map.MapView< K, V >.EntrySet, javolution.util.internal.collection.DistinctCollectionImpl< E >, javolution.util.internal.collection.ReversedCollectionImpl< E >, javolution.util.internal.collection.UnmodifiableCollectionImpl< E >, javolution.util.internal.collection.ParallelCollectionImpl< E >, and javolution.util.internal.collection.SequentialCollectionImpl< E >.
Definition at line 155 of file CollectionView.java.
|
abstractinherited |
Returns an iterator over this collection elements. For shared/atomic collections the iterator is immune to concurrent modifications. In other words the elements iterated over may or may not reflect the current state of the collection.
Reimplemented from javolution.util.FastCollection< E >.
Reimplemented in javolution.util.internal.bitset.BitSetServiceImpl, javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.table.FastTableImpl< E >, javolution.util.internal.table.SharedTableImpl< E >, javolution.util.internal.collection.AtomicCollectionImpl< E >, javolution.util.internal.set.sorted.SubSortedSetImpl< E >, javolution.util.internal.table.TableView< E >, javolution.util.internal.collection.SortedCollectionImpl< E >, javolution.util.internal.map.MapView< K, V >.EntrySet, javolution.util.internal.collection.DistinctCollectionImpl< E >, javolution.util.internal.collection.FilteredCollectionImpl< E >, javolution.util.internal.table.AtomicTableImpl< E >, javolution.util.internal.collection.ReversedCollectionImpl< E >, javolution.util.internal.collection.UnmodifiableCollectionImpl< E >, javolution.util.internal.collection.ParallelCollectionImpl< E >, and javolution.util.internal.collection.SequentialCollectionImpl< E >.
Referenced by javolution.util.internal.collection.CollectionView< R >.clear(), javolution.util.internal.collection.CollectionView< R >.contains(), javolution.util.internal.collection.CollectionView< R >.equals(), javolution.util.internal.collection.CollectionView< R >.hashCode(), javolution.util.internal.collection.CollectionView< R >.isEmpty(), javolution.util.internal.collection.CollectionView< R >.remove(), javolution.util.internal.collection.CollectionView< R >.removeAll(), javolution.util.internal.collection.CollectionView< R >.retainAll(), javolution.util.internal.collection.CollectionView< R >.size(), and javolution.util.internal.collection.CollectionView< R >.toArray().
|
packageinherited |
Returns a view exposing elements through the specified mapping function. The returned view does not allow new elements to be added.
Definition at line 258 of file FastCollection.java.
Referenced by javolution.xml.internal.stream.EntitiesImpl.setEntitiesMapping().
|
inherited |
Returns the largest element of this collection using this collection comparator (convenience method). Returns
if this collection is empty.
Definition at line 541 of file FastCollection.java.
References javolution.util.function.Reducers.max().
|
inherited |
Returns the smallest element of this collection using this collection comparator (convenience method). Returns
if this collection is empty.
Definition at line 528 of file FastCollection.java.
References javolution.util.function.Reducers.min().
|
inherited |
Returns a parallel collection. Parallel collections affect only closure-based operations, all others operations behaving the same. Parallel actions are performed concurrently using Javolution ConcurrentContext. The number of parallel views is derived from the context concurrency (
). Parallel views do not require this collection to be thread-safe (internal synchronization).
Definition at line 222 of file FastCollection.java.
|
inherited |
Reimplemented in javolution.util.internal.collection.ParallelCollectionImpl< E >, javolution.util.internal.collection.SharedCollectionImpl< E >, and javolution.util.internal.collection.SequentialCollectionImpl< E >.
Definition at line 163 of file CollectionView.java.
|
inherited |
Executes a read-only action on the specified part of this object.
action | the read-only action. |
part | this object or a part of it. |
UnsupportedOperationException | if the action tries to update the specified part. |
|
inherited |
Executes the specified read-only action on this collection. That logic may be performed concurrently on sub-collections if this collection is parallel.
action | the read-only action. |
UnsupportedOperationException | if the action tries to update this collection and this collection is thread-safe. |
ClassCastException | if the action type is not compatible with this collection (e.g. action on set and this is a list). |
Definition at line 315 of file FastCollection.java.
|
inherited |
Performs a reduction of the elements of this collection using the specified reducer. This may not involve iterating over all the collection elements, for example the reducers: Reducers#any, Reducers#and and Reducers#or may stop iterating early. Reduction is performed concurrently if this collection is parallel.
reducer | the collection reducer. |
Definition at line 396 of file FastCollection.java.
|
abstract |
Removes the specified element from this collection.
Reimplemented from javolution.util.internal.collection.CollectionView< E >.
Reimplemented in javolution.util.internal.set.sorted.SubSortedSetImpl< E >, javolution.util.internal.map.MapView< K, V >.EntrySet, and javolution.util.internal.bitset.BitSetServiceImpl.
|
inherited |
Removes all the specified element from this collection.
Reimplemented from javolution.util.FastCollection< E >.
Reimplemented in javolution.util.internal.collection.SharedCollectionImpl< E >, and javolution.util.internal.collection.AtomicCollectionImpl< E >.
Definition at line 186 of file CollectionView.java.
|
inherited |
Removes from this collection all the elements matching the specified functional predicate (convenience method). Removals are performed concurrently if this collection is parallel and atomically if this collection is atomic.
filter | a predicate returning true
|
Definition at line 368 of file FastCollection.java.
|
inherited |
Removes all the elements except those in the specified collection.
Reimplemented from javolution.util.FastCollection< E >.
Reimplemented in javolution.util.internal.collection.SharedCollectionImpl< E >, and javolution.util.internal.collection.AtomicCollectionImpl< E >.
Definition at line 199 of file CollectionView.java.
|
inherited |
Returns a view exposing elements in reverse iterative order.
Reimplemented in javolution.util.FastTable< E >.
Definition at line 282 of file FastCollection.java.
|
inherited |
Returns a sequential view of this collection. Using this view, all closure-based iterations are performed sequentially.
Definition at line 230 of file FastCollection.java.
|
protectedinherited |
Returns the service implementation of this collection (for sub-classes).
Reimplemented from javolution.util.FastCollection< E >.
Definition at line 274 of file CollectionView.java.
|
staticprotectedinherited |
Returns the service implementation of any fast collection (for sub-classes).
Definition at line 647 of file FastCollection.java.
References javolution.util.FastCollection< E >.service().
|
inherited |
Returns a thread-safe view over this collection. The shared view allows for concurrent read as long as there is no writer. The default implementation is based on readers-writers locks giving priority to writers. Iterators on shared collections are thread-safe (no ConcurrentModificationException possible).
Reimplemented in javolution.util.FastTable< E >, javolution.util.FastSet< E >, javolution.util.FastSortedTable< E >, and javolution.util.FastSortedSet< E >.
Definition at line 201 of file FastCollection.java.
|
abstract |
Returns the size of this collection.
Reimplemented from javolution.util.internal.collection.CollectionView< E >.
Reimplemented in javolution.util.internal.bitset.BitSetServiceImpl, javolution.util.internal.set.sorted.SubSortedSetImpl< E >, and javolution.util.internal.map.MapView< K, V >.EntrySet.
|
inherited |
Returns a view exposing elements sorted according to the collection order.
Definition at line 267 of file FastCollection.java.
Referenced by javolution.util.internal.collection.SortedCollectionImpl< E >.IteratorImpl.IteratorImpl().
|
inherited |
Returns a view exposing elements sorted according to the specified comparator.
Definition at line 275 of file FastCollection.java.
|
inherited |
Returns
distinct parts of this object. This method may return an array of size less than
(e.g. an array of size one if this object cannot split).
n | the number of parts. |
IllegalArgumentException | if n <= 1
|
Implements javolution.util.function.Splittable< T >.
Reimplemented in javolution.util.internal.table.SharedTableImpl< E >, javolution.util.internal.table.TableView< E >, javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.table.AtomicTableImpl< E >, javolution.util.internal.collection.AtomicCollectionImpl< E >, and javolution.util.internal.map.MapView< K, V >.EntrySet.
Definition at line 224 of file CollectionView.java.
|
protected |
Returns the actual target
Reimplemented from javolution.util.internal.collection.CollectionView< E >.
Reimplemented in javolution.util.internal.set.sorted.SortedSetView< E >.
Definition at line 45 of file SetView.java.
Referenced by javolution.util.internal.set.SetView< Index >.SetView().
SetService<E> javolution.util.internal.set.SetView< E >.threadSafe | ( | ) |
Returns a thread-safe version of this service (used during parallel updates).
Reimplemented from javolution.util.internal.collection.CollectionView< E >.
Reimplemented in javolution.util.internal.set.sorted.SortedSetView< E >.
Definition at line 39 of file SetView.java.
|
inherited |
Returns an array holding this collection elements.
Reimplemented from javolution.util.FastCollection< E >.
Reimplemented in javolution.util.internal.collection.SharedCollectionImpl< E >, and javolution.util.internal.collection.AtomicCollectionImpl< E >.
Definition at line 243 of file CollectionView.java.
Referenced by javolution.util.internal.collection.CollectionView< R >.toArray().
|
packageinherited |
Returns the specified array holding this collection elements if enough capacity.
Reimplemented from javolution.util.FastCollection< E >.
Reimplemented in javolution.util.internal.collection.SharedCollectionImpl< E >, and javolution.util.internal.collection.AtomicCollectionImpl< E >.
Definition at line 249 of file CollectionView.java.
|
packageinherited |
Returns an immutable reference over this collection. The immutable value is an unmodifiable view of this collection. The caller must guarantees that the original collection is never going to be updated (e.g. there is no reference left of the original collection).
Definition at line 585 of file FastCollection.java.
|
inherited |
Returns the string representation of this collection using its default format.
Definition at line 634 of file FastCollection.java.
References javolution.text.TextContext.getFormat().
|
inherited |
Returns an unmodifiable view over this collection. Any attempt to modify the collection through this view will result into a java.lang.UnsupportedOperationException being raised.
Reimplemented in javolution.util.FastTable< E >, javolution.util.FastSet< E >, javolution.util.FastSortedTable< E >, and javolution.util.FastSortedSet< E >.
Definition at line 239 of file FastCollection.java.
|
inherited |
Reimplemented in javolution.util.internal.collection.ParallelCollectionImpl< E >, javolution.util.internal.collection.AtomicCollectionImpl< E >, and javolution.util.internal.collection.SequentialCollectionImpl< E >.
Definition at line 266 of file CollectionView.java.
|
inherited |
Executes an update action on the specified part of this object. Any change to the part is reflected in the whole (this object).
action | the action authorized to update this object part. |
part | this object or a part of it. |
|
inherited |
Executes the specified update action on this collection. That logic may be performed concurrently on sub-collections if this collection is parallel. For atomic collections the update is atomic (either concurrent readers see the full result of the action or nothing).
action | the update action. |
ClassCastException | if the action type is not compatible with this collection (e.g. action on set and this is a list). |
Definition at line 334 of file FastCollection.java.
Referenced by javolution.util.FastTable< javolution.xml.internal.stream.XMLStreamReaderImpl >.sort().
|
staticprivate |
Definition at line 20 of file SetView.java.