Javolution 6.0.0 java
|
Classes | |
class | Format |
Public Member Functions | |
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 | perform (Consumer<? extends Collection< E >> action) |
void | update (Consumer<? extends Collection< E >> action) |
void | forEach (final Consumer<? super E > consumer) |
boolean | removeIf (final Predicate<? super E > filter) |
E | reduce (Reducer< E > reducer) |
boolean | add (E element) |
boolean | isEmpty () |
int | size () |
void | clear () |
boolean | contains (Object searched) |
boolean | remove (Object searched) |
Iterator< E > | iterator () |
boolean | addAll (final Collection<? extends E > that) |
boolean | containsAll (Collection<?> that) |
boolean | removeAll (final Collection<?> that) |
boolean | retainAll (final Collection<?> that) |
Object[] | toArray () |
E | min () |
E | max () |
FastCollection< E > | addAll (E... elements) |
FastCollection< E > | addAll (FastCollection<? extends E > that) |
Equality<? super E > | comparator () |
boolean | equals (Object obj) |
int | hashCode () |
String | toString () |
Protected Member Functions | |
FastCollection () | |
abstract CollectionService< E > | service () |
Static Protected Member Functions | |
static< E > CollectionService< E > | serviceOf (FastCollection< E > collection) |
Package Functions | |
public< R > FastCollection< R > | mapped (Function<? super E, ? extends R > function) |
public< T > T[] | toArray (final T[] array) |
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 |
A closure-based collection supporting numerous views which can be chained.
shared - Thread-safe view using allowing concurrent reads based on mutex (readers-writer locks). @javalink #parallel} - A view allowing parallel processing including @javalink #update updates}. @javalink #sequential} - View disallowing parallel processing. @javalink #unmodifiable} - View which does not allow any modification. @javalink #filtered filtered(filter)} - View exposing only the elements matching the specified filter. @javalink #mapped mapped(function)} - View exposing elements through the specified mapping function. @javalink #sorted sorted(comparator)} - View exposing elements sorted according to their natural order of using a specified comparator. @javalink #reversed} - View exposing elements in the reverse iterative order. @javalink #distinct} - View exposing each element only once. Unmodifiable collections are not always immutable. An @javalink javolution.lang.Immutable immutable}. reference (or const reference) can only be @javalink #toImmutable() obtained} when the originator guarantees that the collection source will not be modified even by himself (the value of the immutable reference being an @javalink #unmodifiable unmodifiable} collection). [code] Immutable<List<String>> winners = new FastTable<String>().addAll("John Deuff", "Otto Graf", "Sim Kamil").toImmutable(); // Immutability is guaranteed, no reference left on the collection source. [/code] Atomic collections use Copy-On-Write optimizations in order to provide mutex-free read access. Only writes operations are mutually exclusive. Collections can be optimized to not require the full copy during write operations (e.g. immutable parts don't need to be copied). Still, when multiple updates are performed, it is beneficial to group them into one single update operation. [code] FastTable<String> tokens = ... ... // Replace null with "" in tokens. If tokens is atomic the update is atomic. // If tokens is parallel, the update is also performed concurrently ! tokens.update(new Consumer<List<String>>() {
public void accept(List<String> view) { for (int i=0, n = view.size(); i < n; i++) if (view.get(i) == null) view.set(i, ""); } } });[/code]
The same code using closure (Java 8). [code] tokens.update((List<String> view) -> { for (int i = 0, n = view.size(); i < n; i++) { if (view.get(i) == null) view.set(i, ""); } });[/code]
Views are similar to Java 8 streams except that views are themselves collections (virtual collections) and actions on a view can impact the original collection. Collection views are nothing "new" since they already existed in the original java.util collection classes (e.g. List.subList(...), Map.keySet(), Map.values()). Javolution extends to this concept and allows views to be chained which addresses the concern of class proliferation.
[code] FastTable<String> names = new FastTable<String>().addAll("Oscar Thon", "Eva Poret", "Paul Auchon"); boolean found = names.comparator(Equalities.LEXICAL_CASE_INSENSITIVE).contains("LUC SURIEUX"); names.subTable(0, n).clear(); // Removes the n first names (see java.util.List.subList). names.distinct().add("Guy Liguili"); // Adds "Guy Liguili" only if not already present. names.filtered(isLong).clear(); // Removes all the persons with long names. names.filtered(isLong).parallel().clear(); // Same as above but performed concurrently ! ... Predicate<CharSequence> isLong = new Predicate<CharSequence>() { public boolean test(CharSequence csq) { return csq.length() > 16; } });[/code]
Views can of course be used to perform "stream" oriented filter-map-reduce operations with the same benefits: Parallelism support, excellent memory characteristics (no caching and cost nothing to create), etc. [code] String anyLongName = names.filtered(isLong).any(String.class); // Returns any long name. int nbrChars = names.mapped(toLength).reduce(Reducers.sum()); // Returns the total number of characters. int maxLength = names.mapped(toLength).parallel().max(); // Finds the longest name in parallel. ... Function<CharSequence, Integer> toLength = new Function<CharSequence, Integer>() { public Integer apply(CharSequence csq) { return csq.length(); } });
// JDK Class.getEnclosingMethod using Javolution's views and Java 8 (to be compared with the current 20 lines implementation !). Method matching = new FastTable<Method>().addAll(enclosingInfo.getEnclosingClass().getDeclaredMethods()) .filtered(m -> Equalities.STANDARD.areEqual(m.getName(), enclosingInfo.getName()) .filtered(m -> Equalities.ARRAY.areEqual(m.getParameterTypes(), parameterClasses)) .filtered(m -> Equalities.STANDARD.areEqual(m.getReturnType(), returnType)) .any(Method.class); if (matching == null) throw new InternalError("Enclosing method not found"); return matching;[/code]
If a collection (or a map) is shared, derived views are also thread-safe. Similarly, if a collection is parallel, closure-based iterations on derived views are performed concurrently. [code] FastMap<String, Runnable> tasks = ... ... tasks.values().parallel().forEach(new Consumer<Runnable>() { // Executes task concurrently. public void accept(Runnable task) { task.run(); } });[/code]
With Java 8, closures are greatly simplified using lambda expressions. [code] tasks.values().parallel().forEach(task -> task.run()); // Same as above. names.sorted().reversed().forEach(str -> System.out.println(str)); // Prints names in reverse alphabetical order. [/code]
Definition at line 166 of file FastCollection.java.
|
protected |
boolean javolution.util.FastCollection< E >.add | ( | E | element | ) |
Adds the specified element to this collection
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.collection.CollectionView< E >, javolution.util.internal.table.sorted.FastSortedTableImpl< E >, javolution.util.internal.table.UnmodifiableTableImpl< E >, javolution.util.FastSortedSet< 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 >.
Definition at line 408 of file FastCollection.java.
FastCollection<E> javolution.util.FastCollection< E >.addAll | ( | E... | elements | ) |
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.
FastCollection<E> javolution.util.FastCollection< E >.addAll | ( | FastCollection<? extends E > | that | ) |
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.
boolean javolution.util.FastCollection< E >.addAll | ( | final Collection<? extends E > | that | ) |
Adds all the specified elements to this collection.
Reimplemented in javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.collection.AtomicCollectionImpl< E >, and javolution.util.internal.collection.CollectionView< E >.
Definition at line 462 of file FastCollection.java.
|
package |
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().
FastCollection<E> javolution.util.FastCollection< E >.atomic | ( | ) |
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.
void javolution.util.FastCollection< E >.clear | ( | ) |
Removes all elements from this collection.
Reimplemented in javolution.util.FastTable< E >, javolution.util.FastSet< E >, 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.collection.CollectionView< 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 429 of file FastCollection.java.
Equality<? super E> javolution.util.FastCollection< E >.comparator | ( | ) |
Returns the comparator uses by this collection for equality and/or ordering if this collection is sorted.
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.CollectionView< 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 >.
Definition at line 574 of file FastCollection.java.
Referenced by javolution.util.FastSet< Index >.FastSet(), javolution.util.FastSortedSet< E >.FastSortedSet(), javolution.util.FastSortedTable< E >.FastSortedTable(), and javolution.util.FastTable< javolution.xml.internal.stream.XMLStreamReaderImpl >.FastTable().
boolean javolution.util.FastCollection< E >.contains | ( | Object | searched | ) |
Indicates if this collection contains the specified element.
Reimplemented in javolution.util.FastSet< E >, javolution.util.FastSortedSet< E >, javolution.util.internal.set.sorted.SubSortedSetImpl< E >, javolution.util.internal.collection.SortedCollectionImpl< E >, javolution.util.FastSortedTable< E >, javolution.util.internal.collection.CollectionView< E >, javolution.util.internal.map.MapView< K, V >.EntrySet, javolution.util.internal.collection.ReversedCollectionImpl< E >, javolution.util.internal.collection.UnmodifiableCollectionImpl< E >, javolution.util.internal.collection.ParallelCollectionImpl< E >, javolution.util.internal.collection.SequentialCollectionImpl< E >, javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.collection.AtomicCollectionImpl< E >, javolution.util.internal.collection.FilteredCollectionImpl< E >, javolution.util.internal.collection.DistinctCollectionImpl< E >, javolution.util.internal.table.TableView< E >, javolution.util.internal.set.SetView< E >, and javolution.util.internal.bitset.BitSetServiceImpl.
Definition at line 436 of file FastCollection.java.
boolean javolution.util.FastCollection< E >.containsAll | ( | Collection<?> | that | ) |
Indicates if this collection contains all the specified elements.
Reimplemented in javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.collection.AtomicCollectionImpl< E >, and javolution.util.internal.collection.CollectionView< E >.
Definition at line 469 of file FastCollection.java.
FastCollection<E> javolution.util.FastCollection< E >.distinct | ( | ) |
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.
boolean javolution.util.FastCollection< E >.equals | ( | Object | obj | ) |
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 in javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.collection.AtomicCollectionImpl< E >, and javolution.util.internal.collection.CollectionView< E >.
Definition at line 611 of file FastCollection.java.
FastCollection<E> javolution.util.FastCollection< E >.filtered | ( | Predicate<? super E > | filter | ) |
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.
void javolution.util.FastCollection< E >.forEach | ( | final Consumer<? super E > | consumer | ) |
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().
int javolution.util.FastCollection< E >.hashCode | ( | ) |
Returns the hash code of this collection. This method follows the Collection#hashCode() specification if this collection comparator is Equalities#STANDARD.
Reimplemented in javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.collection.CollectionView< E >, and javolution.util.internal.collection.AtomicCollectionImpl< E >.
Definition at line 625 of file FastCollection.java.
boolean javolution.util.FastCollection< E >.isEmpty | ( | ) |
Indicates if this collection is empty.
Reimplemented in javolution.util.FastTable< E >, javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.collection.CollectionView< E >, javolution.util.internal.collection.AtomicCollectionImpl< E >, javolution.util.internal.set.sorted.SubSortedSetImpl< E >, javolution.util.FastSet< 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 415 of file FastCollection.java.
Iterator<E> javolution.util.FastCollection< E >.iterator | ( | ) |
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 in javolution.util.internal.bitset.BitSetServiceImpl, javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.collection.CollectionView< 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 >.
Definition at line 455 of file FastCollection.java.
Referenced by javolution.xml.internal.stream.NamespacesImpl.getPrefixes().
|
package |
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().
E javolution.util.FastCollection< E >.max | ( | ) |
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().
E javolution.util.FastCollection< E >.min | ( | ) |
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().
FastCollection<E> javolution.util.FastCollection< E >.parallel | ( | ) |
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.
void javolution.util.FastCollection< E >.perform | ( | Consumer<? extends Collection< E >> | action | ) |
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.
E javolution.util.FastCollection< E >.reduce | ( | Reducer< E > | reducer | ) |
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.
boolean javolution.util.FastCollection< E >.remove | ( | Object | searched | ) |
Removes the specified element from this collection.
Reimplemented in javolution.util.internal.collection.CollectionView< E >, javolution.util.internal.set.sorted.SubSortedSetImpl< E >, javolution.util.FastSet< E >, javolution.util.internal.map.MapView< K, V >.EntrySet, javolution.util.internal.collection.SortedCollectionImpl< E >, javolution.util.FastSortedSet< E >, javolution.util.internal.collection.ReversedCollectionImpl< E >, javolution.util.FastSortedTable< E >, javolution.util.internal.collection.ParallelCollectionImpl< E >, javolution.util.internal.collection.SequentialCollectionImpl< E >, javolution.util.internal.table.TableView< E >, javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.collection.AtomicCollectionImpl< E >, javolution.util.internal.collection.FilteredCollectionImpl< E >, javolution.util.internal.collection.DistinctCollectionImpl< E >, javolution.util.internal.collection.UnmodifiableCollectionImpl< E >, javolution.util.internal.set.SetView< E >, and javolution.util.internal.bitset.BitSetServiceImpl.
Definition at line 443 of file FastCollection.java.
boolean javolution.util.FastCollection< E >.removeAll | ( | final Collection<?> | that | ) |
Removes all the specified element from this collection.
Reimplemented in javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.collection.CollectionView< E >, and javolution.util.internal.collection.AtomicCollectionImpl< E >.
Definition at line 476 of file FastCollection.java.
boolean javolution.util.FastCollection< E >.removeIf | ( | final Predicate<? super E > | filter | ) |
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.
boolean javolution.util.FastCollection< E >.retainAll | ( | final Collection<?> | that | ) |
Removes all the elements except those in the specified collection.
Reimplemented in javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.collection.CollectionView< E >, and javolution.util.internal.collection.AtomicCollectionImpl< E >.
Definition at line 483 of file FastCollection.java.
FastCollection<E> javolution.util.FastCollection< E >.reversed | ( | ) |
Returns a view exposing elements in reverse iterative order.
Reimplemented in javolution.util.FastTable< E >.
Definition at line 282 of file FastCollection.java.
FastCollection<E> javolution.util.FastCollection< E >.sequential | ( | ) |
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.
|
abstractprotected |
Returns the service implementation of this collection (for sub-classes).
Reimplemented in javolution.util.FastTable< E >, javolution.util.internal.collection.CollectionView< E >, javolution.util.FastSortedSet< E >, javolution.util.FastSet< E >, and javolution.util.FastSortedTable< E >.
Referenced by javolution.util.FastCollection< E >.serviceOf().
|
staticprotected |
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().
FastCollection<E> javolution.util.FastCollection< E >.shared | ( | ) |
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.
int javolution.util.FastCollection< E >.size | ( | ) |
Returns the size of this collection.
Reimplemented in javolution.util.internal.bitset.BitSetServiceImpl, javolution.util.internal.table.TableView< E >, javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.collection.CollectionView< E >, javolution.util.internal.table.FastTableImpl< E >, javolution.util.FastTable< E >, javolution.util.internal.collection.AtomicCollectionImpl< E >, javolution.util.internal.set.sorted.SubSortedSetImpl< E >, javolution.util.internal.map.MapView< K, V >.EntrySet, javolution.util.FastSet< E >, javolution.util.internal.collection.SortedCollectionImpl< E >, javolution.util.internal.collection.ReversedCollectionImpl< E >, javolution.util.internal.table.SubTableImpl< E >, javolution.util.internal.collection.ParallelCollectionImpl< E >, javolution.util.internal.collection.UnmodifiableCollectionImpl< E >, javolution.util.internal.table.UnmodifiableTableImpl< E >, javolution.util.internal.collection.SequentialCollectionImpl< E >, javolution.util.internal.table.ReversedTableImpl< E >, and javolution.util.internal.set.SetView< E >.
Definition at line 422 of file FastCollection.java.
FastCollection<E> javolution.util.FastCollection< E >.sorted | ( | ) |
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().
FastCollection<E> javolution.util.FastCollection< E >.sorted | ( | Comparator<? super E > | cmp | ) |
Returns a view exposing elements sorted according to the specified comparator.
Definition at line 275 of file FastCollection.java.
Object [] javolution.util.FastCollection< E >.toArray | ( | ) |
Returns an array holding this collection elements.
Reimplemented in javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.collection.CollectionView< E >, and javolution.util.internal.collection.AtomicCollectionImpl< E >.
Definition at line 490 of file FastCollection.java.
|
package |
Returns the specified array holding this collection elements if enough capacity.
Reimplemented in javolution.util.internal.collection.SharedCollectionImpl< E >, javolution.util.internal.collection.CollectionView< E >, and javolution.util.internal.collection.AtomicCollectionImpl< E >.
Definition at line 498 of file FastCollection.java.
|
package |
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.
String javolution.util.FastCollection< E >.toString | ( | ) |
Returns the string representation of this collection using its default format.
Definition at line 634 of file FastCollection.java.
References javolution.text.TextContext.getFormat().
FastCollection<E> javolution.util.FastCollection< E >.unmodifiable | ( | ) |
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.
void javolution.util.FastCollection< E >.update | ( | Consumer<? extends Collection< E >> | action | ) |
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 168 of file FastCollection.java.