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

Classes

class  IteratorImpl
 

Public Member Functions

 FastTableImpl (Equality<? super E > comparator)
 
boolean add (E element)
 
void add (int index, E element)
 
void addFirst (E element)
 
void addLast (E element)
 
void clear ()
 
FastTableImpl< E > clone ()
 
Equality<? super E > comparator ()
 
get (int index)
 
getFirst ()
 
getLast ()
 
Iterator< E > iterator ()
 
remove (int index)
 
removeFirst ()
 
removeLast ()
 
set (int index, E element)
 
int size ()
 
boolean addAll (int index, Collection<? extends E > c)
 
boolean addAll (Collection<? extends E > c)
 
FastCollection< E > addAll (E... elements)
 
FastCollection< E > addAll (FastCollection<? extends E > that)
 
final boolean contains (Object o)
 
Iterator< E > descendingIterator ()
 
final E element ()
 
int indexOf (Object o)
 
final boolean isEmpty ()
 
int lastIndexOf (Object o)
 
final ListIterator< E > listIterator ()
 
ListIterator< E > listIterator (int index)
 
final boolean offer (E e)
 
final boolean offerFirst (E e)
 
final boolean offerLast (E e)
 
final E peek ()
 
peekFirst ()
 
peekLast ()
 
final E poll ()
 
pollFirst ()
 
pollLast ()
 
final E pop ()
 
final void push (E e)
 
final E remove ()
 
final boolean remove (Object o)
 
boolean removeFirstOccurrence (Object o)
 
boolean removeLastOccurrence (Object o)
 
CollectionService< E >[] split (int n)
 
TableService< E > subList (int fromIndex, int toIndex)
 
TableService< E > threadSafe ()
 
boolean containsAll (Collection<?> c)
 
boolean equals (Object o)
 
int hashCode ()
 
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)
 
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)
 
reduce (Reducer< E > reducer)
 
min ()
 
max ()
 
String toString ()
 

Protected Member Functions

void emptyError ()
 
void indexError (int index)
 
TableService< 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 ()
 

Private Member Functions

void checkUpsize ()
 
void readObject (java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException
 
void upsize ()
 
void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException
 

Private Attributes

transient int capacity
 
final Equality<? super E > comparator
 
transient FractalTableImpl fractal
 
transient int size
 

Static Private Attributes

static final long serialVersionUID = 0x600L
 

Detailed Description

The default FastTable implementation based on fractal tables. The memory footprint is minimal when the table is cleared.

Definition at line 21 of file FastTableImpl.java.

Constructor & Destructor Documentation

◆ FastTableImpl()

Definition at line 56 of file FastTableImpl.java.

56  {
57  super(null); // Root class.
58  this.comparator = comparator;
59  }

References javolution.util.internal.table.FastTableImpl< E >.comparator.

Member Function Documentation

◆ add() [1/2]

boolean javolution.util.internal.table.FastTableImpl< E >.add ( element)

Adds the specified element to this collection

Reimplemented from javolution.util.internal.collection.CollectionView< E >.

Reimplemented in javolution.util.internal.table.sorted.FastSortedTableImpl< E >.

Definition at line 62 of file FastTableImpl.java.

62  {
64  return true;
65  }

References javolution.util.internal.table.FastTableImpl< E >.addLast(), and javolution.util.internal.table.TableView< E >.element().

Here is the call graph for this function:

◆ add() [2/2]

void javolution.util.internal.table.FastTableImpl< E >.add ( int  index,
element 
)

Reimplemented from javolution.util.internal.table.TableView< E >.

Definition at line 68 of file FastTableImpl.java.

68  {
69  if ((index < 0) || (index > size)) indexError(index);
70  checkUpsize();
71  if (index >= (size >> 1)) {
72  fractal.shiftRight(element, index, size - index);
73  } else {
74  fractal.shiftLeft(element, index - 1, index);
75  fractal.offset--;
76  }
77  size++;
78  }

References javolution.util.internal.table.FastTableImpl< E >.checkUpsize(), javolution.util.internal.table.TableView< E >.element(), javolution.util.internal.table.FastTableImpl< E >.fractal, javolution.util.internal.table.TableView< E >.indexError(), javolution.util.internal.table.FractalTableImpl.offset, javolution.util.internal.table.FractalTableImpl.shiftLeft(), javolution.util.internal.table.FractalTableImpl.shiftRight(), and javolution.util.internal.table.FastTableImpl< E >.size.

Here is the call graph for this function:

◆ addAll() [1/4]

boolean javolution.util.internal.collection.CollectionView< E >.addAll ( Collection<? extends E >  that)
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.

46  {
47  boolean changed = false;
48  Iterator<? extends E> it = c.iterator();
49  while (it.hasNext()) {
50  if (add(it.next())) changed = true;
51  }
52  return changed;
53  }

◆ addAll() [2/4]

FastCollection<E> javolution.util.FastCollection< E >.addAll ( E...  elements)
inherited

Returns this collection with the specified element added.

Parameters
elementsthe elements to be added.
Returns
this

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.

552  {
553  for (E e : elements) {
554  add(e);
555  }
556  return this;
557  }

◆ addAll() [3/4]

FastCollection<E> javolution.util.FastCollection< E >.addAll ( FastCollection<? extends E >  that)
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.

564  {
565  addAll((Collection<? extends E>) that);
566  return this;
567  }

◆ addAll() [4/4]

boolean javolution.util.internal.table.TableView< E >.addAll ( int  index,
Collection<? extends E >  c 
)
inherited

Definition at line 40 of file TableView.java.

40  {
41  return subList(index, index).addAll(c);
42  }

References javolution.util.internal.table.TableView< E >.subList().

Referenced by javolution.util.internal.table.FastTableImpl< E >.clone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addFirst()

◆ addLast()

void javolution.util.internal.table.FastTableImpl< E >.addLast ( element)

Reimplemented from javolution.util.internal.table.TableView< E >.

Definition at line 89 of file FastTableImpl.java.

89  {
90  checkUpsize();
91  fractal.set(size++, element);
92  }

References javolution.util.internal.table.FastTableImpl< E >.checkUpsize(), javolution.util.internal.table.TableView< E >.element(), javolution.util.internal.table.FastTableImpl< E >.fractal, javolution.util.internal.table.FractalTableImpl.set(), and javolution.util.internal.table.FastTableImpl< E >.size.

Referenced by javolution.util.internal.table.FastTableImpl< E >.add(), and javolution.util.internal.table.FastTableImpl< E >.readObject().

Here is the call graph for this function:
Here is the caller graph for this function:

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

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

187  {
188  return new AtomicCollectionImpl<E>(service());
189  }

◆ checkUpsize()

void javolution.util.internal.table.FastTableImpl< E >.checkUpsize ( )
private

Definition at line 182 of file FastTableImpl.java.

182  {
183  if (size >= capacity) upsize();
184  }

References javolution.util.internal.table.FastTableImpl< E >.capacity, javolution.util.internal.table.FastTableImpl< E >.size, and javolution.util.internal.table.FastTableImpl< E >.upsize().

Referenced by javolution.util.internal.table.FastTableImpl< E >.add(), javolution.util.internal.table.FastTableImpl< E >.addFirst(), and javolution.util.internal.table.FastTableImpl< E >.addLast().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear()

◆ clone()

Returns a copy of this collection; updates of the copy should not impact the original.

Reimplemented from javolution.util.internal.collection.CollectionView< E >.

Definition at line 102 of file FastTableImpl.java.

102  { // Make a copy.
103  FastTableImpl<E> copy = new FastTableImpl<E>(comparator());
104  copy.addAll(this);
105  return copy;
106  }

References javolution.util.internal.table.TableView< E >.addAll(), and javolution.util.internal.table.FastTableImpl< E >.comparator.

Here is the call graph for this function:

◆ comparator()

Returns the comparator uses by this collection for equality and/or ordering if this collection is sorted.

Reimplemented from javolution.util.internal.collection.CollectionView< E >.

Definition at line 109 of file FastTableImpl.java.

109  {
110  return comparator;
111  }

References javolution.util.internal.table.FastTableImpl< E >.comparator.

◆ contains()

final boolean javolution.util.internal.table.TableView< E >.contains ( Object  searched)
inherited

Indicates if this collection contains the specified element.

Reimplemented from javolution.util.internal.collection.CollectionView< E >.

Definition at line 58 of file TableView.java.

58  {
59  return indexOf(o) >= 0;
60  }

References javolution.util.internal.table.TableView< E >.indexOf().

Referenced by javolution.util.internal.table.sorted.SortedTableView< E >.addIfAbsent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ containsAll()

boolean javolution.util.internal.collection.CollectionView< E >.containsAll ( Collection<?>  that)
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.

93  {
94  for (Object e : c) {
95  if (!contains(e)) return false;
96  }
97  return true;
98  }

Referenced by javolution.util.internal.collection.CollectionView< R >.equals().

Here is the caller graph for this function:

◆ descendingIterator()

Iterator<E> javolution.util.internal.table.TableView< E >.descendingIterator ( )
inherited

Definition at line 63 of file TableView.java.

63  {
64  return new ReversedTableImpl<E>(this).iterator();
65  }

References javolution.util.internal.table.TableView< E >.iterator().

Here is the call graph for this function:

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

final E javolution.util.internal.table.TableView< E >.element ( )
inherited

Definition at line 68 of file TableView.java.

68  {
69  return getFirst();
70  }

References javolution.util.internal.table.TableView< E >.getFirst().

Referenced by javolution.util.internal.table.ReversedTableImpl< E >.add(), javolution.util.internal.table.sorted.FastSortedTableImpl< Entry< K, V > >.add(), javolution.util.internal.table.SubTableImpl< E >.add(), javolution.util.internal.table.FastTableImpl< E >.add(), javolution.util.internal.table.TableView< E >.addFirst(), javolution.util.internal.table.FastTableImpl< E >.addFirst(), javolution.util.internal.table.sorted.SortedTableView< E >.addIfAbsent(), javolution.util.internal.table.sorted.FastSortedTableImpl< Entry< K, V > >.addIfAbsent(), javolution.util.internal.table.TableView< E >.addLast(), javolution.util.internal.table.FastTableImpl< E >.addLast(), javolution.util.internal.table.sorted.FastSortedTableImpl< Entry< K, V > >.indexOf(), javolution.util.internal.table.sorted.UnmodifiableSortedTableImpl< E >.positionOf(), javolution.util.internal.table.sorted.FastSortedTableImpl< Entry< K, V > >.positionOf(), javolution.util.internal.table.ReversedTableImpl< E >.set(), javolution.util.internal.table.SubTableImpl< E >.set(), and javolution.util.internal.table.FastTableImpl< E >.set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ emptyError()

void javolution.util.internal.table.TableView< E >.emptyError ( )
protectedinherited

◆ equals()

boolean javolution.util.internal.collection.CollectionView< 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 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.

102  {
103  // Follow Collection.equals specification if this comparator is standard.
104  if (this == o) return true;
105  // Check comparators consistency.
106  if (o instanceof CollectionService) {
107  if (!comparator().equals(((CollectionService<E>) o).comparator())) return false; // Different comparators.
108  } else {
109  if (!comparator().equals(Equalities.STANDARD)) return false;
110  }
111  // Collection.equals contract.
112  if (this instanceof Set) {
113  if (!(o instanceof Set)) return false;
114  Set<E> set = (Set<E>) o;
115  return (size() == set.size()) && containsAll(set);
116  } else if (this instanceof List) {
117  if (!(o instanceof List)) return false;
118  List<E> list = (List<E>) o;
119  if (size() != list.size()) return false; // Short-cut.
120  Equality<? super E> cmp = comparator();
121  Iterator<E> it1 = this.iterator();
122  Iterator<E> it2 = list.iterator();
123  while (it1.hasNext()) {
124  if (!it2.hasNext()) return false;
125  if (!cmp.areEqual(it1.next(), it2.next())) return false;
126  }
127  if (it2.hasNext()) return false;
128  return true;
129  } else {
130  return false;
131  }
132  }

Referenced by javolution.util.internal.collection.CollectionView< R >.equals().

Here is the caller graph for this function:

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

Reimplemented from javolution.util.internal.table.TableView< E >.

Definition at line 115 of file FastTableImpl.java.

115  {
116  if ((index < 0) && (index >= size)) indexError(index);
117  return (E) fractal.get(index);
118  }

References javolution.util.internal.table.FastTableImpl< E >.fractal, javolution.util.internal.table.FractalTableImpl.get(), javolution.util.internal.table.TableView< E >.indexError(), and javolution.util.internal.table.FastTableImpl< E >.size.

Here is the call graph for this function:

◆ getFirst()

Reimplemented from javolution.util.internal.table.TableView< E >.

Definition at line 121 of file FastTableImpl.java.

121  {
122  if (size == 0) emptyError();
123  return get(0);
124  }

References javolution.util.internal.table.TableView< E >.emptyError(), and javolution.util.internal.table.FastTableImpl< E >.size.

Here is the call graph for this function:

◆ getLast()

Reimplemented from javolution.util.internal.table.TableView< E >.

Definition at line 127 of file FastTableImpl.java.

127  {
128  if (size == 0) emptyError();
129  return get(size - 1);
130  }

References javolution.util.internal.table.TableView< E >.emptyError(), and javolution.util.internal.table.FastTableImpl< E >.size.

Here is the call graph for this function:

◆ hashCode()

int javolution.util.internal.collection.CollectionView< 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 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.

135  {
136  // Follow Collection.equals specification if this comparator is standard.
137  Equality<? super E> cmp = comparator();
138  Iterator<E> it = this.iterator();
139  int hash = 0;
140  if (this instanceof Set) {
141  while (it.hasNext()) {
142  hash += cmp.hashCodeOf(it.next());
143  }
144  } else if (this instanceof List) {
145  while (it.hasNext()) {
146  hash += 31 * hash + cmp.hashCodeOf(it.next());
147  }
148  } else {
149  hash = super.hashCode();
150  }
151  return hash;
152  }

◆ indexError()

void javolution.util.internal.table.TableView< E >.indexError ( int  index)
protectedinherited

Throws IndexOutOfBoundsException

Definition at line 255 of file TableView.java.

255  {
256  throw new IndexOutOfBoundsException("index: " + index + ", size: "
257  + size());
258  }

References javolution.util.internal.table.TableView< E >.size().

Referenced by javolution.util.internal.table.SubTableImpl< E >.add(), javolution.util.internal.table.FastTableImpl< E >.add(), javolution.util.internal.table.SubTableImpl< E >.get(), javolution.util.internal.table.FastTableImpl< E >.get(), javolution.util.internal.table.SubTableImpl< E >.remove(), javolution.util.internal.table.FastTableImpl< E >.remove(), javolution.util.internal.table.SubTableImpl< E >.set(), and javolution.util.internal.table.FastTableImpl< E >.set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ indexOf()

int javolution.util.internal.table.TableView< E >.indexOf ( Object  o)
inherited

Reimplemented in javolution.util.internal.table.UnmodifiableTableImpl< E >, javolution.util.internal.table.sorted.SortedTableView< E >, javolution.util.internal.table.ReversedTableImpl< E >, and javolution.util.internal.table.sorted.FastSortedTableImpl< E >.

Definition at line 89 of file TableView.java.

89  {
90  Equality<Object> cmp = (Equality<Object>) this.comparator();
91  for (int i = 0, n = size(); i < n; i++) {
92  if (cmp.areEqual(o, get(i))) return i;
93  }
94  return -1;
95  }

References javolution.util.function.Equality< T >.areEqual(), javolution.util.internal.collection.CollectionView< E >.comparator(), and javolution.util.internal.table.TableView< E >.size().

Referenced by javolution.util.internal.table.TableView< E >.contains(), javolution.util.internal.table.TableView< E >.remove(), and javolution.util.internal.table.TableView< E >.removeFirstOccurrence().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEmpty()

final boolean javolution.util.internal.table.TableView< E >.isEmpty ( )
inherited

Indicates if this collection is empty.

Reimplemented from javolution.util.internal.collection.CollectionView< E >.

Definition at line 98 of file TableView.java.

98  {
99  return size() == 0;
100  }

References javolution.util.internal.table.TableView< E >.size().

Here is the call graph for this function:

◆ iterator()

Iterator<E> javolution.util.internal.table.FastTableImpl< 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 from javolution.util.internal.table.TableView< E >.

Definition at line 133 of file FastTableImpl.java.

133  {
134  return new IteratorImpl();
135  }

◆ lastIndexOf()

int javolution.util.internal.table.TableView< E >.lastIndexOf ( Object  o)
inherited

Reimplemented in javolution.util.internal.table.sorted.SortedTableView< E >, javolution.util.internal.table.UnmodifiableTableImpl< E >, and javolution.util.internal.table.ReversedTableImpl< E >.

Definition at line 109 of file TableView.java.

109  {
110  Equality<Object> cmp = (Equality<Object>) this.comparator();
111  for (int i = size() - 1; i >= 0; i--) {
112  if (cmp.areEqual(o, get(i))) return i;
113  }
114  return -1;
115  }

References javolution.util.function.Equality< T >.areEqual(), javolution.util.internal.collection.CollectionView< E >.comparator(), and javolution.util.internal.table.TableView< E >.size().

Referenced by javolution.util.internal.table.TableView< E >.removeLastOccurrence().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ listIterator() [1/2]

final ListIterator<E> javolution.util.internal.table.TableView< E >.listIterator ( )
inherited

Definition at line 118 of file TableView.java.

118  {
119  return listIterator(0);
120  }

Referenced by javolution.util.internal.table.TableView< E >.iterator().

Here is the caller graph for this function:

◆ listIterator() [2/2]

ListIterator<E> javolution.util.internal.table.TableView< E >.listIterator ( int  index)
inherited

Definition at line 123 of file TableView.java.

123  {
124  return new TableIteratorImpl<E>(this, index);
125  }

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

final boolean javolution.util.internal.table.TableView< E >.offer ( e)
inherited

Definition at line 128 of file TableView.java.

128  {
129  return offerLast(e);
130  }

References javolution.util.internal.table.TableView< E >.offerLast().

Here is the call graph for this function:

◆ offerFirst()

final boolean javolution.util.internal.table.TableView< E >.offerFirst ( e)
inherited

Definition at line 133 of file TableView.java.

133  {
134  addFirst(e);
135  return true;
136  }

References javolution.util.internal.table.TableView< E >.addFirst().

Here is the call graph for this function:

◆ offerLast()

final boolean javolution.util.internal.table.TableView< E >.offerLast ( e)
inherited

Definition at line 139 of file TableView.java.

139  {
140  addLast(e);
141  return true;
142  }

References javolution.util.internal.table.TableView< E >.addLast().

Referenced by javolution.util.internal.table.TableView< E >.offer().

Here is the call graph for this function:
Here is the caller graph for this function:

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

final E javolution.util.internal.table.TableView< E >.peek ( )
inherited

Definition at line 145 of file TableView.java.

145  {
146  return peekFirst();
147  }

References javolution.util.internal.table.TableView< E >.peekFirst().

Here is the call graph for this function:

◆ peekFirst()

E javolution.util.internal.table.TableView< E >.peekFirst ( )
inherited

Definition at line 150 of file TableView.java.

150  {
151  return (size() == 0) ? null : getFirst();
152  }

References javolution.util.internal.table.TableView< E >.getFirst(), and javolution.util.internal.table.TableView< E >.size().

Referenced by javolution.util.internal.table.TableView< E >.peek().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ peekLast()

E javolution.util.internal.table.TableView< E >.peekLast ( )
inherited

Definition at line 155 of file TableView.java.

155  {
156  return (size() == 0) ? null : getLast();
157  }

References javolution.util.internal.table.TableView< E >.getLast(), and javolution.util.internal.table.TableView< E >.size().

Here is the call graph for this function:

◆ perform() [1/3]

void javolution.util.internal.collection.CollectionView< E >.perform ( Consumer< CollectionService< E >>  action,
CollectionService< E >  view 
)
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.

163  {
164  if (target == null) {
165  action.accept(view);
166  } else {
167  target.perform(action, view);
168  }
169  }

◆ perform() [2/3]

void javolution.util.function.Splittable< T >.perform ( Consumer< T >  action,
part 
)
inherited

Executes a read-only action on the specified part of this object.

Parameters
actionthe read-only action.
partthis object or a part of it.
Exceptions
UnsupportedOperationExceptionif the action tries to update the specified part.

◆ perform() [3/3]

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

final E javolution.util.internal.table.TableView< E >.poll ( )
inherited

Definition at line 160 of file TableView.java.

160  {
161  return pollFirst();
162  }

References javolution.util.internal.table.TableView< E >.pollFirst().

Here is the call graph for this function:

◆ pollFirst()

E javolution.util.internal.table.TableView< E >.pollFirst ( )
inherited

Definition at line 165 of file TableView.java.

165  {
166  return (size() == 0) ? null : removeFirst();
167  }

References javolution.util.internal.table.TableView< E >.removeFirst(), and javolution.util.internal.table.TableView< E >.size().

Referenced by javolution.util.internal.table.TableView< E >.poll().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pollLast()

E javolution.util.internal.table.TableView< E >.pollLast ( )
inherited

Definition at line 170 of file TableView.java.

170  {
171  return (size() == 0) ? null : removeLast();
172  }

References javolution.util.internal.table.TableView< E >.removeLast(), and javolution.util.internal.table.TableView< E >.size().

Here is the call graph for this function:

◆ pop()

final E javolution.util.internal.table.TableView< E >.pop ( )
inherited

Definition at line 175 of file TableView.java.

175  {
176  return removeFirst();
177  }

References javolution.util.internal.table.TableView< E >.removeFirst().

Here is the call graph for this function:

◆ push()

final void javolution.util.internal.table.TableView< E >.push ( e)
inherited

Definition at line 180 of file TableView.java.

180  {
181  addFirst(e);
182  }

References javolution.util.internal.table.TableView< E >.addFirst().

Here is the call graph for this function:

◆ readObject()

void javolution.util.internal.table.FastTableImpl< E >.readObject ( java.io.ObjectInputStream  s) throws java.io.IOException, ClassNotFoundException
private

For serialization support

Definition at line 188 of file FastTableImpl.java.

189  {
190  s.defaultReadObject(); // Deserialize comparator.
191  int n = s.readInt();
192  for (int i = 0; i < n; i++)
193  addLast((E) s.readObject());
194  }

References javolution.util.internal.table.FastTableImpl< E >.addLast().

Here is the call graph for this function:

◆ 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]

final E javolution.util.internal.table.TableView< E >.remove ( )
inherited

Definition at line 185 of file TableView.java.

185  {
186  return removeFirst();
187  }

References javolution.util.internal.table.TableView< E >.removeFirst().

Here is the call graph for this function:

◆ remove() [2/3]

E javolution.util.internal.table.FastTableImpl< E >.remove ( int  index)

Reimplemented from javolution.util.internal.table.TableView< E >.

Definition at line 139 of file FastTableImpl.java.

139  {
140  if ((index < 0) || (index >= size)) indexError(index);
141  E removed = (E) fractal.get(index);
142  if (index >= (size >> 1)) {
143  fractal.shiftLeft(null, size - 1, size - index - 1);
144  } else {
145  fractal.shiftRight(null, 0, index);
146  fractal.offset++;
147  }
148  size--;
149  return removed;
150  }

References javolution.util.internal.table.FastTableImpl< E >.fractal, javolution.util.internal.table.FractalTableImpl.get(), javolution.util.internal.table.TableView< E >.indexError(), javolution.util.internal.table.FractalTableImpl.offset, javolution.util.internal.table.FractalTableImpl.shiftLeft(), javolution.util.internal.table.FractalTableImpl.shiftRight(), and javolution.util.internal.table.FastTableImpl< E >.size.

Referenced by javolution.util.internal.table.FastTableImpl< E >.IteratorImpl.remove().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove() [3/3]

final boolean javolution.util.internal.table.TableView< E >.remove ( Object  searched)
inherited

Removes the specified element from this collection.

Reimplemented from javolution.util.internal.collection.CollectionView< E >.

Definition at line 193 of file TableView.java.

193  {
194  int i = indexOf(o);
195  if (i < 0) return false;
196  remove(i);
197  return true;
198  }

References javolution.util.internal.table.TableView< E >.indexOf().

Here is the call graph for this function:

◆ removeAll()

boolean javolution.util.internal.collection.CollectionView< E >.removeAll ( Collection<?>  that)
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.

186  {
187  boolean changed = false;
188  Iterator<? extends E> it = iterator();
189  while (it.hasNext()) {
190  if (c.contains(it.next())) {
191  it.remove();
192  changed = true;
193  }
194  }
195  return changed;
196  }

◆ removeFirst()

Reimplemented from javolution.util.internal.table.TableView< E >.

Definition at line 154 of file FastTableImpl.java.

154  {
155  if (size == 0) emptyError();
156  E first = (E) fractal.set(0, null);
157  fractal.offset++;
158  size--;
159  return first;
160  }

References javolution.util.internal.table.TableView< E >.emptyError(), javolution.util.internal.table.FastTableImpl< E >.fractal, javolution.util.internal.table.FractalTableImpl.offset, javolution.util.internal.table.FractalTableImpl.set(), and javolution.util.internal.table.FastTableImpl< E >.size.

Here is the call graph for this function:

◆ removeFirstOccurrence()

boolean javolution.util.internal.table.TableView< E >.removeFirstOccurrence ( Object  o)
inherited

Definition at line 207 of file TableView.java.

207  {
208  int i = indexOf(o);
209  if (i < 0) return false;
210  remove(i);
211  return true;
212  }

References javolution.util.internal.table.TableView< E >.indexOf().

Here is the call graph for this function:

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

Reimplemented from javolution.util.internal.table.TableView< E >.

Definition at line 164 of file FastTableImpl.java.

164  {
165  if (size == 0) emptyError();
166  E last = (E) fractal.set(--size, null);
167  return last;
168  }

References javolution.util.internal.table.TableView< E >.emptyError(), javolution.util.internal.table.FastTableImpl< E >.fractal, javolution.util.internal.table.FractalTableImpl.set(), and javolution.util.internal.table.FastTableImpl< E >.size.

Here is the call graph for this function:

◆ removeLastOccurrence()

boolean javolution.util.internal.table.TableView< E >.removeLastOccurrence ( Object  o)
inherited

Definition at line 221 of file TableView.java.

221  {
222  int i = lastIndexOf(o);
223  if (i < 0) return false;
224  remove(i);
225  return true;
226  }

References javolution.util.internal.table.TableView< E >.lastIndexOf().

Here is the call graph for this function:

◆ retainAll()

boolean javolution.util.internal.collection.CollectionView< E >.retainAll ( Collection<?>  that)
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.

199  {
200  boolean changed = false;
201  Iterator<? extends E> it = iterator();
202  while (it.hasNext()) {
203  if (!c.contains(it.next())) {
204  it.remove();
205  changed = true;
206  }
207  }
208  return changed;
209  }

◆ reversed()

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

Returns a view exposing elements in reverse iterative order.

Reimplemented in javolution.util.FastTable< E >.

Definition at line 282 of file FastCollection.java.

282  {
283  return new ReversedCollectionImpl<E>(service());
284  }

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

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

Reimplemented from javolution.util.FastCollection< E >.

Definition at line 274 of file CollectionView.java.

274  {
275  return this;
276  }

◆ 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.internal.table.FastTableImpl< E >.set ( int  index,
element 
)

Reimplemented from javolution.util.internal.table.TableView< E >.

Definition at line 172 of file FastTableImpl.java.

172  {
173  if ((index < 0) && (index >= size)) indexError(index);
174  return (E) fractal.set(index, element);
175  }

References javolution.util.internal.table.TableView< E >.element(), javolution.util.internal.table.FastTableImpl< E >.fractal, javolution.util.internal.table.TableView< E >.indexError(), javolution.util.internal.table.FractalTableImpl.set(), and javolution.util.internal.table.FastTableImpl< E >.size.

Here is the call graph for this function:

◆ shared()

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

201  {
202  return new SharedCollectionImpl<E>(service());
203  }

◆ size()

Returns the size of this collection.

Reimplemented from javolution.util.internal.table.TableView< E >.

Definition at line 178 of file FastTableImpl.java.

178  {
179  return size;
180  }

References javolution.util.internal.table.FastTableImpl< E >.size.

◆ 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  }

◆ split()

CollectionService<E> [] javolution.util.internal.table.TableView< E >.split ( int  n)
inherited

Returns

n

distinct parts of this object. This method may return an array of size less than

n

(e.g. an array of size one if this object cannot split).

Parameters
nthe number of parts.
Returns
the distinct parts (or views) for this object.
Exceptions
IllegalArgumentExceptionif
n <= 1

Reimplemented from javolution.util.internal.collection.CollectionView< E >.

Definition at line 235 of file TableView.java.

235  {
236  return SubTableImpl.splitOf(this, n); // Sub-views over this.
237  }

References javolution.util.internal.table.SubTableImpl< E >.splitOf().

Here is the call graph for this function:

◆ subList()

TableService<E> javolution.util.internal.table.TableView< E >.subList ( int  fromIndex,
int  toIndex 
)
inherited

Implements javolution.util.service.TableService< E >.

Definition at line 240 of file TableView.java.

240  {
241  return new SubTableImpl<E>(this, fromIndex, toIndex);
242  }

Referenced by javolution.util.internal.table.TableView< E >.addAll().

Here is the caller graph for this function:

◆ target()

TableService<E> javolution.util.internal.table.TableView< E >.target ( )
protectedinherited

Returns the actual target

Reimplemented from javolution.util.internal.collection.CollectionView< E >.

Reimplemented in javolution.util.internal.table.sorted.SortedTableView< E >, and javolution.util.internal.table.sorted.UnmodifiableSortedTableImpl< E >.

Definition at line 262 of file TableView.java.

262  {
263  return (TableService<E>) super.target();
264  }

Referenced by javolution.util.internal.table.ReversedTableImpl< E >.add(), javolution.util.internal.table.SubTableImpl< E >.add(), javolution.util.internal.table.ReversedTableImpl< E >.clear(), javolution.util.internal.table.SubTableImpl< E >.clear(), javolution.util.internal.table.ReversedTableImpl< E >.comparator(), javolution.util.internal.table.UnmodifiableTableImpl< E >.comparator(), javolution.util.internal.table.SubTableImpl< E >.comparator(), javolution.util.internal.table.ReversedTableImpl< E >.get(), javolution.util.internal.table.UnmodifiableTableImpl< E >.get(), javolution.util.internal.table.SubTableImpl< E >.get(), javolution.util.internal.table.ReversedTableImpl< E >.indexOf(), javolution.util.internal.table.UnmodifiableTableImpl< E >.indexOf(), javolution.util.internal.table.ReversedTableImpl< E >.lastIndexOf(), javolution.util.internal.table.UnmodifiableTableImpl< E >.lastIndexOf(), javolution.util.internal.table.ReversedTableImpl< E >.remove(), javolution.util.internal.table.SubTableImpl< E >.remove(), javolution.util.internal.table.ReversedTableImpl< E >.set(), javolution.util.internal.table.SubTableImpl< E >.set(), javolution.util.internal.table.ReversedTableImpl< E >.size(), javolution.util.internal.table.UnmodifiableTableImpl< E >.size(), javolution.util.internal.table.SubTableImpl< E >.SubTableImpl(), javolution.util.internal.table.TableView< E >.TableView(), and javolution.util.internal.table.UnmodifiableTableImpl< E >.UnmodifiableTableImpl().

Here is the caller graph for this function:

◆ threadSafe()

TableService<E> javolution.util.internal.table.TableView< E >.threadSafe ( )
inherited

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.table.UnmodifiableTableImpl< E >, javolution.util.internal.table.sorted.SortedTableView< E >, javolution.util.internal.table.sorted.FastSortedTableImpl< E >, and javolution.util.internal.table.sorted.UnmodifiableSortedTableImpl< E >.

Definition at line 245 of file TableView.java.

245  {
246  return new SharedTableImpl<E>(this);
247  }

◆ toArray() [1/2]

Object [] javolution.util.internal.collection.CollectionView< E >.toArray ( )
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.

243  {
244  return toArray(new Object[size()]);
245  }

Referenced by javolution.util.internal.collection.CollectionView< R >.toArray().

Here is the caller graph for this function:

◆ toArray() [2/2]

public<T> T [] javolution.util.internal.collection.CollectionView< E >.toArray ( T[]  array)
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.

249  {
250  final int size = size();
251  final T[] result = (size <= a.length) ? a
252  : (T[]) java.lang.reflect.Array.newInstance(a.getClass()
253  .getComponentType(), size);
254  int i = 0;
255  Iterator<E> it = iterator();
256  while (it.hasNext()) {
257  result[i++] = (T) it.next();
258  }
259  if (result.length > size) {
260  result[size] = null; // As per Collection contract.
261  }
262  return result;
263  }

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

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

239  {
240  return new UnmodifiableCollectionImpl<E>(service());
241  }

◆ update() [1/3]

void javolution.util.internal.collection.CollectionView< E >.update ( Consumer< CollectionService< E >>  action,
CollectionService< E >  view 
)
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.

266  {
267  if (target == null) {
268  action.accept(view);
269  } else {
270  target.perform(action, view);
271  }
272  }

◆ update() [2/3]

void javolution.util.function.Splittable< T >.update ( Consumer< T >  action,
part 
)
inherited

Executes an update action on the specified part of this object. Any change to the part is reflected in the whole (this object).

Parameters
actionthe action authorized to update this object part.
partthis object or a part of it.

◆ update() [3/3]

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:

◆ upsize()

void javolution.util.internal.table.FastTableImpl< E >.upsize ( )
private

Definition at line 196 of file FastTableImpl.java.

196  {
197  fractal = (fractal == null) ? new FractalTableImpl() : fractal.upsize();
199  }

References javolution.util.internal.table.FastTableImpl< E >.capacity, javolution.util.internal.table.FractalTableImpl.capacity(), javolution.util.internal.table.FastTableImpl< E >.fractal, and javolution.util.internal.table.FractalTableImpl.upsize().

Referenced by javolution.util.internal.table.FastTableImpl< E >.checkUpsize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeObject()

void javolution.util.internal.table.FastTableImpl< E >.writeObject ( java.io.ObjectOutputStream  s) throws java.io.IOException
private

For serialization support

Definition at line 202 of file FastTableImpl.java.

203  {
204  s.defaultWriteObject(); // Serialize comparator.
205  s.writeInt(size);
206  for (int i = 0; i < size; i++)
207  s.writeObject(fractal.get(i));
208  }

References javolution.util.internal.table.FastTableImpl< E >.fractal, javolution.util.internal.table.FractalTableImpl.get(), and javolution.util.internal.table.FastTableImpl< E >.size.

Here is the call graph for this function:

Member Data Documentation

◆ capacity

◆ comparator

◆ fractal

◆ serialVersionUID

final long javolution.util.internal.table.FastTableImpl< E >.serialVersionUID = 0x600L
staticprivate

Definition at line 50 of file FastTableImpl.java.

◆ size


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.internal.table.TableView.pollFirst
E pollFirst()
Definition: TableView.java:165
javolution.util.internal.table.FractalTableImpl.set
Object set(int index, Object element)
Definition: FractalTableImpl.java:63
javolution.util.FastCollection.update
void update(Consumer<? extends Collection< E >> action)
Definition: FastCollection.java:334
javolution.util.internal.table.FastTableImpl.fractal
transient FractalTableImpl fractal
Definition: FastTableImpl.java:53
javolution.util.internal.collection.CollectionView.add
abstract boolean add(E element)
javolution.util.internal.table.FastTableImpl.upsize
void upsize()
Definition: FastTableImpl.java:196
javolution.util.FastCollection.reduce
E reduce(Reducer< E > reducer)
Definition: FastCollection.java:396
javolution.util.internal.table.TableView.offerLast
final boolean offerLast(E e)
Definition: TableView.java:139
javolution.util.internal.table.FastTableImpl.comparator
final Equality<? super E > comparator
Definition: FastTableImpl.java:52
javolution.util.FastCollection.service
abstract CollectionService< E > service()
javolution.util.internal.table.TableView.getFirst
E getFirst()
Definition: TableView.java:76
javolution.util.internal.collection.CollectionView.contains
boolean contains(Object obj)
Definition: CollectionView.java:83
javolution.util.internal.table.TableView.lastIndexOf
int lastIndexOf(Object o)
Definition: TableView.java:109
javolution.util.internal.collection.CollectionView.comparator
abstract Equality<? super E > comparator()
javolution.util.internal.table.FractalTableImpl.get
Object get(int index)
Definition: FractalTableImpl.java:57
javolution.util.internal.collection.CollectionView.size
int size()
Definition: CollectionView.java:212
javolution.util.internal.table.TableView.addLast
void addLast(E element)
Definition: TableView.java:50
javolution.util.internal.table.TableView.removeFirst
E removeFirst()
Definition: TableView.java:201
javolution.util.internal.table.FractalTableImpl.capacity
int capacity()
Definition: FractalTableImpl.java:51
javolution.util.internal.collection.CollectionView.target
CollectionService< E > target
Definition: CollectionView.java:33
javolution.util.internal.collection.CollectionView.iterator
abstract Iterator< E > iterator()
javolution.util.FastCollection.addAll
boolean addAll(final Collection<? extends E > that)
Definition: FastCollection.java:462
javolution.util.internal.collection.CollectionView.equals
boolean equals(Object o)
Definition: CollectionView.java:102
javolution.util.internal.table.TableView.removeLast
E removeLast()
Definition: TableView.java:215
javolution.util.FastCollection.unmodifiable
FastCollection< E > unmodifiable()
Definition: FastCollection.java:239
javolution.util.internal.table.TableView.element
final E element()
Definition: TableView.java:68
javolution.util.internal.table.TableView.size
abstract int size()
javolution.util.internal.table.TableView.getLast
E getLast()
Definition: TableView.java:82
javolution.util.FastCollection.add
boolean add(E element)
Definition: FastCollection.java:408
javolution.util.FastCollection.parallel
FastCollection< E > parallel()
Definition: FastCollection.java:222
javolution.util.FastCollection.FastCollection
FastCollection()
Definition: FastCollection.java:173
javolution.util.internal.table.TableView.indexError
void indexError(int index)
Definition: TableView.java:255
javolution.util.internal.table.TableView.subList
TableService< E > subList(int fromIndex, int toIndex)
Definition: TableView.java:240
javolution.util.internal.table.TableView.indexOf
int indexOf(Object o)
Definition: TableView.java:89
javolution.util.internal.collection.CollectionView.toArray
Object[] toArray()
Definition: CollectionView.java:243
javolution.util.internal.table.FractalTableImpl.upsize
FractalTableImpl upsize()
Definition: FractalTableImpl.java:133
javolution.util.internal.table.FractalTableImpl.shiftRight
void shiftRight(Object inserted, int first, int length)
Definition: FractalTableImpl.java:104
javolution.util.internal.table.FractalTableImpl.shiftLeft
void shiftLeft(Object inserted, int last, int length)
Definition: FractalTableImpl.java:73
javolution.util.internal.table.FastTableImpl.checkUpsize
void checkUpsize()
Definition: FastTableImpl.java:182
javolution.util.internal.table.FractalTableImpl.offset
int offset
Definition: FractalTableImpl.java:26
javolution.util.FastCollection.perform
void perform(Consumer<? extends Collection< E >> action)
Definition: FastCollection.java:315
javolution.util.internal.table.FastTableImpl.addLast
void addLast(E element)
Definition: FastTableImpl.java:89
javolution.util.internal.table.TableView.addFirst
void addFirst(E element)
Definition: TableView.java:45
javolution.util.internal.table.TableView.emptyError
void emptyError()
Definition: TableView.java:250
javolution.util.internal.table.TableView.listIterator
final ListIterator< E > listIterator()
Definition: TableView.java:118
javolution.util.internal.table.FastTableImpl.capacity
transient int capacity
Definition: FastTableImpl.java:51
javolution.util.internal.table.FastTableImpl.size
transient int size
Definition: FastTableImpl.java:54
javolution.util.internal.table.TableView.peekFirst
E peekFirst()
Definition: TableView.java:150
javolution.util.internal.collection.CollectionView.containsAll
boolean containsAll(Collection<?> c)
Definition: CollectionView.java:93