Javolution 6.0.0 java
javolution.util.FastSortedTable< E > Class Template Reference
Inheritance diagram for javolution.util.FastSortedTable< E >:
[legend]
Collaboration diagram for javolution.util.FastSortedTable< E >:
[legend]

Public Member Functions

 FastSortedTable ()
 
 FastSortedTable (Equality<? super E > comparator)
 
FastSortedTable< E > atomic ()
 
FastSortedTable< E > shared ()
 
FastSortedTable< E > unmodifiable ()
 
boolean contains (Object obj)
 
boolean remove (Object obj)
 
int indexOf (final Object obj)
 
boolean addIfAbsent (E element)
 
int positionOf (E element)
 
FastSortedTable< E > addAll (E... elements)
 
FastSortedTable< E > addAll (FastCollection<? extends E > that)
 
FastTable< E > reversed ()
 
FastTable< E > subTable (int fromIndex, int toIndex)
 
boolean isEmpty ()
 
int size ()
 
void clear ()
 
void add (int index, E element)
 
boolean add (E element)
 
boolean addAll (final int index, Collection<? extends E > elements)
 
boolean addAll (final Collection<? extends E > that)
 
remove (int index)
 
remove ()
 
get (int index)
 
set (int index, E element)
 
int lastIndexOf (final Object element)
 
ListIterator< E > listIterator ()
 
ListIterator< E > listIterator (int index)
 
void addFirst (E element)
 
void addLast (E element)
 
getFirst ()
 
getLast ()
 
peekFirst ()
 
peekLast ()
 
pollFirst ()
 
pollLast ()
 
removeFirst ()
 
removeLast ()
 
boolean offerFirst (E e)
 
boolean offerLast (E e)
 
boolean removeFirstOccurrence (Object o)
 
boolean removeLastOccurrence (Object o)
 
boolean offer (E e)
 
poll ()
 
element ()
 
peek ()
 
void push (E e)
 
pop ()
 
Iterator< E > descendingIterator ()
 
void sort ()
 
FastTable< E > subList (int fromIndex, int toIndex)
 
FastCollection< E > parallel ()
 
FastCollection< E > sequential ()
 
FastCollection< E > filtered (Predicate<? super E > filter)
 
FastCollection< E > sorted ()
 
FastCollection< E > sorted (Comparator<? super E > cmp)
 
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)
 
reduce (Reducer< E > reducer)
 
Iterator< E > iterator ()
 
boolean containsAll (Collection<?> that)
 
boolean removeAll (final Collection<?> that)
 
boolean retainAll (final Collection<?> that)
 
Object[] toArray ()
 
min ()
 
max ()
 
Equality<? super E > comparator ()
 
boolean equals (Object obj)
 
int hashCode ()
 
String toString ()
 

Protected Member Functions

 FastSortedTable (SortedTableService< E > service)
 
SortedTableService< 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
 

Detailed Description

A high-performance sorted table with real-time behavior. Sorted table have significantly faster contains, indexOf and remove methods).

This class is comparable to FastSortedSet in performance, but it allows for duplicate and implements the java.util.List interface.

Author
Jean-Marie Dautelle
Version
6.0, July 21, 2013

Definition at line 33 of file FastSortedTable.java.

Constructor & Destructor Documentation

◆ FastSortedTable() [1/3]

Creates an empty table sorted using its elements natural order.

Definition at line 40 of file FastSortedTable.java.

40  {
41  this(Equalities.STANDARD);
42  }

References javolution.util.function.Equalities.STANDARD.

◆ FastSortedTable() [2/3]

javolution.util.FastSortedTable< E >.FastSortedTable ( Equality<? super E >  comparator)

Creates an empty table sorted using the specified element comparator.

Definition at line 47 of file FastSortedTable.java.

47  {
48  super(new FastSortedTableImpl<E>(comparator));
49  }

References javolution.util.FastCollection< E >.comparator().

Here is the call graph for this function:

◆ FastSortedTable() [3/3]

Creates a sorted table backed up by the specified service implementation.

Definition at line 54 of file FastSortedTable.java.

54  {
55  super(service);
56  }

References javolution.util.FastSortedTable< E >.service().

Here is the call graph for this function:

Member Function Documentation

◆ add() [1/2]

◆ add() [2/2]

void javolution.util.FastTable< E >.add ( int  index,
element 
)
inherited

Inserts the specified element at the specified position in this table.

Definition at line 182 of file FastTable.java.

182  {
183  service.add(index, element);
184  }

Referenced by javolution.xml.XMLReferenceResolver.createReference(), javolution.xml.internal.stream.NamespacesImpl.getPrefixes(), and javolution.test.Perfometer< T >.printDetails().

Here is the caller graph for this function:

◆ addAll() [1/4]

FastSortedTable<E> javolution.util.FastSortedTable< E >.addAll ( E...  elements)

Returns this collection with the specified element added.

Parameters
elementsthe elements to be added.
Returns
this

Reimplemented from javolution.util.FastTable< E >.

Definition at line 123 of file FastSortedTable.java.

123  {
124  return (FastSortedTable<E>) super.addAll(elements);
125  }

◆ addAll() [2/4]

FastSortedTable<E> javolution.util.FastSortedTable< E >.addAll ( FastCollection<? extends E >  that)

Returns this collection with the specified collection's elements added in sequence.

Reimplemented from javolution.util.FastTable< E >.

Definition at line 128 of file FastSortedTable.java.

128  {
129  return (FastSortedTable<E>) super.addAll(that);
130  }

◆ addAll() [3/4]

boolean javolution.util.FastCollection< E >.addAll ( final Collection<? extends E >  that)
inherited

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.

462  {
463  return service().addAll(that);
464  }

◆ addAll() [4/4]

boolean javolution.util.FastTable< E >.addAll ( final int  index,
Collection<? extends E >  elements 
)
inherited

Inserts all of the elements in the specified collection into this table at the specified position.

Definition at line 190 of file FastTable.java.

190  {
191  return service.addAll(index, elements);
192  }

Referenced by javolution.xml.internal.stream.EntitiesImpl.setEntitiesMapping().

Here is the caller graph for this function:

◆ addFirst()

void javolution.util.FastTable< E >.addFirst ( element)
inherited

Inserts the specified element at the front of this table.

Definition at line 253 of file FastTable.java.

253  {
254  service.addFirst(element);
255  }

◆ addIfAbsent()

boolean javolution.util.FastSortedTable< E >.addIfAbsent ( element)

Adds the specified element only if not already present.

Returns
true
if the element has been added;
false
otherwise.

Definition at line 109 of file FastSortedTable.java.

109  {
110  return service().addIfAbsent(element);
111  }

References javolution.util.FastTable< E >.element(), and javolution.util.FastSortedTable< E >.service().

Here is the call graph for this function:

◆ addLast()

void javolution.util.FastTable< E >.addLast ( element)
inherited

Inserts the specified element at the end of this table.

Definition at line 260 of file FastTable.java.

260  {
261  service.addLast(element);
262  }

◆ any()

public<T extends E> T javolution.util.FastCollection< E >.any ( Class< T >  type)
packageinherited

Returns any non-null element of the specified type (convenience method).

Parameters
typethe element type searched for.
Returns
reduce(Reducers.any(type))
See also
Reducers::any

Definition at line 515 of file FastCollection.java.

515  {
516  return (T) reduce((Reducer<E>) Reducers.any(type));
517  }

References javolution.util.function.Reducers.any().

Here is the call graph for this function:

◆ 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 from javolution.util.FastTable< E >.

Definition at line 63 of file FastSortedTable.java.

63  {
64  return new FastSortedTable<E>(new AtomicSortedTableImpl<E>(service()));
65  }

References javolution.util.FastSortedTable< E >.service().

Here is the call graph for this function:

◆ clear()

void javolution.util.FastTable< E >.clear ( )
inherited

Removes all elements from this collection.

Reimplemented from javolution.util.FastCollection< E >.

Definition at line 171 of file FastTable.java.

171  {
172  service.clear();
173  }

Referenced by javolution.xml.XMLReferenceResolver.reset().

Here is the caller graph for this function:

◆ comparator()

Equality<? super E> javolution.util.FastCollection< E >.comparator ( )
inherited

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.

574  {
575  return service().comparator();
576  }

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().

Here is the caller graph for this function:

◆ contains()

boolean javolution.util.FastSortedTable< E >.contains ( Object  searched)

Indicates if this collection contains the specified element.

Reimplemented from javolution.util.FastCollection< E >.

Definition at line 83 of file FastSortedTable.java.

83  {
84  return service().contains(obj);
85  }

References javolution.util.FastSortedTable< E >.service().

Here is the call graph for this function:

◆ containsAll()

boolean javolution.util.FastCollection< E >.containsAll ( Collection<?>  that)
inherited

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.

469  {
470  return service().containsAll(that);
471  }

◆ descendingIterator()

Iterator<E> javolution.util.FastTable< E >.descendingIterator ( )
inherited

Returns an iterator over the elements in this table in reverse sequential order.

Definition at line 404 of file FastTable.java.

404  {
405  return service.descendingIterator();
406  }

◆ distinct()

FastCollection<E> javolution.util.FastCollection< E >.distinct ( )
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.

293  {
294  return new DistinctCollectionImpl<E>(service());
295  }

◆ element()

◆ equals()

boolean javolution.util.FastCollection< E >.equals ( Object  obj)
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.

Parameters
objthe object to be compared for equality with this collection
Returns
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.

611  {
612  return service().equals(obj);
613  }

◆ filtered()

FastCollection<E> javolution.util.FastCollection< E >.filtered ( Predicate<? super E >  filter)
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.

250  {
251  return new FilteredCollectionImpl<E>(service(), filter);
252  }

◆ forEach()

void javolution.util.FastCollection< E >.forEach ( final Consumer<? super E >  consumer)
inherited

Iterates over all this collection elements applying the specified consumer (convenience method). Iterations are performed concurrently if the collection is parallel.

Parameters
consumerthe functional consumer applied to the collection elements.

Definition at line 346 of file FastCollection.java.

346  {
347  perform(new Consumer<Collection<E>>() {
348  public void accept(Collection<E> view) {
349  Iterator<E> it = view.iterator();
350  while (it.hasNext()) {
351  consumer.accept(it.next());
352  }
353  }
354  });
355  }

References javolution.util.function.Consumer< T >.accept().

Here is the call graph for this function:

◆ get()

E javolution.util.FastTable< E >.get ( int  index)
inherited

Returns the element at the specified position in this table.

Definition at line 204 of file FastTable.java.

204  {
205  return service.get(index);
206  }

Referenced by javolution.xml.XMLReferenceResolver.readReference().

Here is the caller graph for this function:

◆ getFirst()

E javolution.util.FastTable< E >.getFirst ( )
inherited

Retrieves, but does not remove, the first element of this table.

Definition at line 267 of file FastTable.java.

267  {
268  return service.getFirst();
269  }

◆ getLast()

E javolution.util.FastTable< E >.getLast ( )
inherited

Retrieves, but does not remove, the last element of this table.

Definition at line 274 of file FastTable.java.

274  {
275  return service.getLast();
276  }

◆ hashCode()

int javolution.util.FastCollection< E >.hashCode ( )
inherited

Returns the hash code of this collection. This method follows the Collection#hashCode() specification if this collection comparator is Equalities#STANDARD.

Returns
this collection hash code.

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.

625  {
626  return service().hashCode();
627  }

◆ indexOf()

int javolution.util.FastSortedTable< E >.indexOf ( final Object  element)

Returns the index of the first occurrence of the specified element in this table, or -1 if this table does not contain the element.

Reimplemented from javolution.util.FastTable< E >.

Definition at line 94 of file FastSortedTable.java.

94  {
95  return service().indexOf(obj);
96  }

References javolution.util.FastSortedTable< E >.service().

Here is the call graph for this function:

◆ isEmpty()

boolean javolution.util.FastTable< E >.isEmpty ( )
inherited

Indicates if this collection is empty.

Reimplemented from javolution.util.FastCollection< E >.

Definition at line 159 of file FastTable.java.

159  {
160  return service.isEmpty();
161  }

◆ iterator()

Iterator<E> javolution.util.FastCollection< E >.iterator ( )
inherited

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.

455  {
456  return service().iterator();
457  }

Referenced by javolution.xml.internal.stream.NamespacesImpl.getPrefixes().

Here is the caller graph for this function:

◆ lastIndexOf()

int javolution.util.FastTable< E >.lastIndexOf ( final Object  element)
inherited

Returns the index of the last occurrence of the specified element in this table, or -1 if this table does not contain the element.

Definition at line 227 of file FastTable.java.

227  {
228  return service.lastIndexOf(element);
229  }

◆ listIterator() [1/2]

ListIterator<E> javolution.util.FastTable< E >.listIterator ( )
inherited

Returns a list iterator over the elements in this table.

Definition at line 234 of file FastTable.java.

234  {
235  return service.listIterator();
236  }

◆ listIterator() [2/2]

ListIterator<E> javolution.util.FastTable< E >.listIterator ( int  index)
inherited

Returns a list iterator over the elements in this table, starting at the specified position in the table.

Definition at line 242 of file FastTable.java.

242  {
243  return service.listIterator(index);
244  }

◆ mapped()

public<R> FastCollection<R> javolution.util.FastCollection< E >.mapped ( Function<? super E, ? extends R >  function)
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.

259  {
260  return new MappedCollectionImpl<E, R>(service(), function);
261  }

Referenced by javolution.xml.internal.stream.EntitiesImpl.setEntitiesMapping().

Here is the caller graph for this function:

◆ max()

E javolution.util.FastCollection< E >.max ( )
inherited

Returns the largest element of this collection using this collection comparator (convenience method). Returns

null

if this collection is empty.

Returns
reduce(Reducers.max(comparator()))
See also
Reducers::max

Definition at line 541 of file FastCollection.java.

541  {
542  return reduce(Reducers.max(comparator()));
543  }

References javolution.util.function.Reducers.max().

Here is the call graph for this function:

◆ min()

E javolution.util.FastCollection< E >.min ( )
inherited

Returns the smallest element of this collection using this collection comparator (convenience method). Returns

null

if this collection is empty.

Returns
reduce(Reducers.min(comparator()))
See also
Reducers::min

Definition at line 528 of file FastCollection.java.

528  {
529  return reduce(Reducers.min(comparator()));
530  }

References javolution.util.function.Reducers.min().

Here is the call graph for this function:

◆ offer()

boolean javolution.util.FastTable< E >.offer ( e)
inherited

Inserts the specified element into the queue represented by this table.

Definition at line 355 of file FastTable.java.

355  {
356  return service.offer(e);
357  }

◆ offerFirst()

boolean javolution.util.FastTable< E >.offerFirst ( e)
inherited

Inserts the specified element at the front of this table.

Definition at line 327 of file FastTable.java.

327  {
328  return service.offerFirst(e);
329  }

◆ offerLast()

boolean javolution.util.FastTable< E >.offerLast ( e)
inherited

Inserts the specified element at the end of this table.

Definition at line 334 of file FastTable.java.

334  {
335  return service.offerLast(e);
336  }

◆ parallel()

FastCollection<E> javolution.util.FastCollection< E >.parallel ( )
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 (

number of parallel views = concurrency + 1

). Parallel views do not require this collection to be thread-safe (internal synchronization).

See also
#perform(Consumer)
#update(Consumer)
#forEach(Consumer)
#removeIf(Predicate)
#reduce(Reducer)

Definition at line 222 of file FastCollection.java.

222  {
223  return new ParallelCollectionImpl<E>(service());
224  }

◆ peek()

E javolution.util.FastTable< E >.peek ( )
inherited

Retrieves, but does not remove, the head of the queue represented by this table.

Definition at line 383 of file FastTable.java.

383  {
384  return service.peek();
385  }

◆ peekFirst()

E javolution.util.FastTable< E >.peekFirst ( )
inherited

Retrieves, but does not remove, the first element of this table, or returns null if this table is empty.

Definition at line 282 of file FastTable.java.

282  {
283  return service.peekFirst();
284  }

◆ peekLast()

E javolution.util.FastTable< E >.peekLast ( )
inherited

Retrieves, but does not remove, the last element of this table, or returns null if this table is empty.

Definition at line 290 of file FastTable.java.

290  {
291  return service.peekLast();
292  }

◆ perform()

void javolution.util.FastCollection< E >.perform ( Consumer<? extends Collection< E >>  action)
inherited

Executes the specified read-only action on this collection. That logic may be performed concurrently on sub-collections if this collection is parallel.

Parameters
actionthe read-only action.
Exceptions
UnsupportedOperationExceptionif the action tries to update this collection and this collection is thread-safe.
ClassCastExceptionif the action type is not compatible with this collection (e.g. action on set and this is a list).
See also
#update(Consumer)

Definition at line 315 of file FastCollection.java.

315  {
316  service().perform((Consumer<CollectionService<E>>) action, service());
317  }

◆ poll()

E javolution.util.FastTable< E >.poll ( )
inherited

Retrieves and removes the head of the queue represented by this table.

Definition at line 369 of file FastTable.java.

369  {
370  return service.poll();
371  }

◆ pollFirst()

E javolution.util.FastTable< E >.pollFirst ( )
inherited

Retrieves and removes the first element of this table, or returns null if this table is empty.

Definition at line 298 of file FastTable.java.

298  {
299  return service.pollFirst();
300  }

◆ pollLast()

E javolution.util.FastTable< E >.pollLast ( )
inherited

Definition at line 305 of file FastTable.java.

305  {
306  return service.pollLast();
307  }

◆ pop()

E javolution.util.FastTable< E >.pop ( )
inherited

Pops an element from the stack represented by this table.

Definition at line 397 of file FastTable.java.

397  {
398  return service.pop();
399  }

◆ positionOf()

int javolution.util.FastSortedTable< E >.positionOf ( element)

Returns what would be the index of the specified element if it were to be added or the index of the specified element if already present.

Definition at line 118 of file FastSortedTable.java.

118  {
119  return service().positionOf(element);
120  }

References javolution.util.FastTable< E >.element(), and javolution.util.FastSortedTable< E >.service().

Here is the call graph for this function:

◆ push()

void javolution.util.FastTable< E >.push ( e)
inherited

Pushes an element onto the stack represented by this table.

Definition at line 390 of file FastTable.java.

390  {
391  service.push(e);
392  }

◆ reduce()

E javolution.util.FastCollection< E >.reduce ( Reducer< E >  reducer)
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.

Parameters
reducerthe collection reducer.
Returns
the reduction result.

Definition at line 396 of file FastCollection.java.

396  {
397  perform(reducer);
398  return reducer.get();
399  }

◆ remove() [1/3]

E javolution.util.FastTable< E >.remove ( )
inherited

Retrieves and removes the head of the queue represented by this table.

Definition at line 362 of file FastTable.java.

362  {
363  return service.remove();
364  }

◆ remove() [2/3]

E javolution.util.FastTable< E >.remove ( int  index)
inherited

Removes the element at the specified position in this table.

Definition at line 197 of file FastTable.java.

197  {
198  return service.remove(index);
199  }

◆ remove() [3/3]

boolean javolution.util.FastSortedTable< E >.remove ( Object  searched)

Removes the specified element from this collection.

Reimplemented from javolution.util.FastCollection< E >.

Definition at line 88 of file FastSortedTable.java.

88  {
89  return service().remove(obj);
90  }

References javolution.util.FastSortedTable< E >.service().

Here is the call graph for this function:

◆ removeAll()

boolean javolution.util.FastCollection< E >.removeAll ( final Collection<?>  that)
inherited

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.

476  {
477  return service().removeAll(that);
478  }

◆ removeFirst()

E javolution.util.FastTable< E >.removeFirst ( )
inherited

Retrieves and removes the last element of this table, or returns null if this table is empty.

Definition at line 313 of file FastTable.java.

313  {
314  return service.removeFirst();
315  }

◆ removeFirstOccurrence()

boolean javolution.util.FastTable< E >.removeFirstOccurrence ( Object  o)
inherited

Removes the first occurrence of the specified element from this table.

Definition at line 341 of file FastTable.java.

341  {
342  return service.removeFirstOccurrence(o);
343  }

◆ removeIf()

boolean javolution.util.FastCollection< E >.removeIf ( final Predicate<? super E >  filter)
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.

Parameters
filtera predicate returning
true
for elements to be removed.
Returns
true
if at least one element has been removed;
false
otherwise.

Definition at line 368 of file FastCollection.java.

368  {
369  final boolean[] removed = new boolean[1];
370  update(new Consumer<Collection<E>>() {
371  public void accept(Collection<E> view) {
372  Iterator<E> it = view.iterator();
373  while (it.hasNext()) {
374  if (filter.test(it.next())) {
375  it.remove(); // Ok mutable iteration.
376  removed[0] = true;
377  }
378  }
379  }
380  });
381  return removed[0];
382  }

◆ removeLast()

E javolution.util.FastTable< E >.removeLast ( )
inherited

Retrieves and removes the last element of this table.

Definition at line 320 of file FastTable.java.

320  {
321  return service.removeLast();
322  }

◆ removeLastOccurrence()

boolean javolution.util.FastTable< E >.removeLastOccurrence ( Object  o)
inherited

Removes the last occurrence of the specified element from this table.

Definition at line 348 of file FastTable.java.

348  {
349  return service.removeLastOccurrence(o);
350  }

◆ retainAll()

boolean javolution.util.FastCollection< E >.retainAll ( final Collection<?>  that)
inherited

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.

483  {
484  return service().retainAll(that);
485  }

◆ reversed()

FastTable<E> javolution.util.FastTable< E >.reversed ( )
inherited

Returns a view exposing elements in reverse iterative order.

Reimplemented from javolution.util.FastCollection< E >.

Definition at line 130 of file FastTable.java.

130  {
131  return new FastTable<E>(new ReversedTableImpl<E>(service));
132  }

◆ sequential()

FastCollection<E> javolution.util.FastCollection< E >.sequential ( )
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.

230  {
231  return new SequentialCollectionImpl<E>(service());
232  }

◆ service()

SortedTableService<E> javolution.util.FastSortedTable< E >.service ( )
protected

Holds the actual service implementation.

Reimplemented from javolution.util.FastTable< E >.

Definition at line 133 of file FastSortedTable.java.

133  {
134  return (SortedTableService<E>) super.service();
135  }

Referenced by javolution.util.FastSortedTable< E >.addIfAbsent(), javolution.util.FastSortedTable< E >.atomic(), javolution.util.FastSortedTable< E >.contains(), javolution.util.FastSortedTable< E >.FastSortedTable(), javolution.util.FastSortedTable< E >.indexOf(), javolution.util.FastSortedTable< E >.positionOf(), javolution.util.FastSortedTable< E >.remove(), javolution.util.FastSortedTable< E >.shared(), and javolution.util.FastSortedTable< E >.unmodifiable().

Here is the caller graph for this function:

◆ serviceOf()

static <E> CollectionService<E> javolution.util.FastCollection< E >.serviceOf ( FastCollection< E >  collection)
staticprotectedinherited

Returns the service implementation of any fast collection (for sub-classes).

Definition at line 647 of file FastCollection.java.

648  {
649  return collection.service();
650  }

References javolution.util.FastCollection< E >.service().

Here is the call graph for this function:

◆ set()

E javolution.util.FastTable< E >.set ( int  index,
element 
)
inherited

Replaces the element at the specified position in this table with the specified element.

Definition at line 211 of file FastTable.java.

211  {
212  return service.set(index, element);
213  }

◆ 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 from javolution.util.FastTable< E >.

Definition at line 68 of file FastSortedTable.java.

68  {
69  return new FastSortedTable<E>(new SharedSortedTableImpl<E>(service()));
70  }

References javolution.util.FastSortedTable< E >.service().

Here is the call graph for this function:

◆ size()

int javolution.util.FastTable< E >.size ( )
inherited

Returns the size of this collection.

Reimplemented from javolution.util.FastCollection< E >.

Definition at line 165 of file FastTable.java.

165  {
166  return service.size();
167  }

Referenced by javolution.xml.XMLReferenceResolver.createReference(), and javolution.xml.XMLReferenceResolver.readReference().

Here is the caller graph for this function:

◆ sort()

void javolution.util.FastTable< E >.sort ( )
inherited

Sorts this table in place (quick sort).

Definition at line 416 of file FastTable.java.

416  {
417  update(new Consumer<TableService<E>>() {
418  @Override
419  public void accept(TableService<E> table) {
420  QuickSort<E> qs = new QuickSort<E>(table, table.comparator());
421  qs.sort();
422  }
423  });
424  }

◆ sorted() [1/2]

FastCollection<E> javolution.util.FastCollection< E >.sorted ( )
inherited

Returns a view exposing elements sorted according to the collection order.

Definition at line 267 of file FastCollection.java.

267  {
268  return new SortedCollectionImpl<E>(service(), comparator());
269  }

Referenced by javolution.util.internal.collection.SortedCollectionImpl< E >.IteratorImpl.IteratorImpl().

Here is the caller graph for this function:

◆ sorted() [2/2]

FastCollection<E> javolution.util.FastCollection< E >.sorted ( Comparator<? super E >  cmp)
inherited

Returns a view exposing elements sorted according to the specified comparator.

Definition at line 275 of file FastCollection.java.

275  {
276  return new SortedCollectionImpl<E>(service(), cmp);
277  }

◆ subList()

FastTable<E> javolution.util.FastTable< E >.subList ( int  fromIndex,
int  toIndex 
)
inherited

Replaced by subTable(int, int). The term "List" for an interface with random access is disturbing !

Definition at line 444 of file FastTable.java.

444  {
445  return subTable(fromIndex, toIndex);
446  }

◆ subTable()

FastTable<E> javolution.util.FastTable< E >.subTable ( int  fromIndex,
int  toIndex 
)
inherited

Returns a view over a portion of the table (equivalent to java.util.List#subList(int, int)).

Definition at line 148 of file FastTable.java.

148  {
149  return new FastTable<E>(
150  new SubTableImpl<E>(service, fromIndex, toIndex));
151  }

Referenced by javolution.util.FastTable< javolution.xml.internal.stream.XMLStreamReaderImpl >.subList().

Here is the caller graph for this function:

◆ toArray() [1/2]

Object [] javolution.util.FastCollection< E >.toArray ( )
inherited

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.

490  {
491  return service().toArray();
492  }

◆ toArray() [2/2]

public<T> T [] javolution.util.FastCollection< E >.toArray ( final T[]  array)
packageinherited

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.

498  {
499  return service().toArray(array);
500  }

◆ toImmutable()

public<T extends Collection<E> > Immutable<T> javolution.util.FastCollection< E >.toImmutable ( )
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.

585  {
586  return new Immutable<T>() {
587  @SuppressWarnings("unchecked")
588  final T value = (T) unmodifiable();
589 
590  @Override
591  public T value() {
592  return value;
593  }
594 
595  };
596  }

◆ toString()

String javolution.util.FastCollection< E >.toString ( )
inherited

Returns the string representation of this collection using its default format.

Definition at line 634 of file FastCollection.java.

634  {
635  return TextContext.getFormat(FastCollection.class).format(this);
636  }

References javolution.text.TextContext.getFormat().

Here is the call graph for this function:

◆ 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 from javolution.util.FastTable< E >.

Definition at line 73 of file FastSortedTable.java.

73  {
74  return new FastSortedTable<E>(new UnmodifiableSortedTableImpl<E>(
75  service()));
76  }

References javolution.util.FastSortedTable< E >.service().

Here is the call graph for this function:

◆ update()

void javolution.util.FastCollection< E >.update ( Consumer<? extends Collection< E >>  action)
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).

Parameters
actionthe update action.
Exceptions
ClassCastExceptionif the action type is not compatible with this collection (e.g. action on set and this is a list).
See also
#perform(Consumer)

Definition at line 334 of file FastCollection.java.

334  {
335  service().update((Consumer<CollectionService<E>>) action, service());
336  }

Referenced by javolution.util.FastTable< javolution.xml.internal.stream.XMLStreamReaderImpl >.sort().

Here is the caller graph for this function:

Member Data Documentation

◆ serialVersionUID

final long javolution.util.FastSortedTable< E >.serialVersionUID = 0x600L
staticprivate

Definition at line 35 of file FastSortedTable.java.


The documentation for this class was generated from the following file:
javolution.util.FastCollection.comparator
Equality<? super E > comparator()
Definition: FastCollection.java:574
javolution.util.FastCollection.update
void update(Consumer<? extends Collection< E >> action)
Definition: FastCollection.java:334
javolution.util.FastTable.element
E element()
Definition: FastTable.java:376
javolution.util.FastCollection.reduce
E reduce(Reducer< E > reducer)
Definition: FastCollection.java:396
javolution.util.FastTable.subTable
FastTable< E > subTable(int fromIndex, int toIndex)
Definition: FastTable.java:148
javolution.util.FastCollection.service
abstract CollectionService< E > service()
javolution.util.FastCollection.unmodifiable
FastCollection< E > unmodifiable()
Definition: FastCollection.java:239
javolution.util.FastTable.service
final TableService< E > service
Definition: FastTable.java:95
javolution.util.FastCollection.parallel
FastCollection< E > parallel()
Definition: FastCollection.java:222
javolution.util.FastCollection.FastCollection
FastCollection()
Definition: FastCollection.java:173
javolution.util.FastCollection.perform
void perform(Consumer<? extends Collection< E >> action)
Definition: FastCollection.java:315
javolution.util.FastSortedTable.service
SortedTableService< E > service()
Definition: FastSortedTable.java:133