Javolution 6.0.0 java
javolution.util.internal.map.UnmodifiableMapImpl< K, V > Class Template Reference
Inheritance diagram for javolution.util.internal.map.UnmodifiableMapImpl< K, V >:
[legend]
Collaboration diagram for javolution.util.internal.map.UnmodifiableMapImpl< K, V >:
[legend]

Classes

class  IteratorImpl
 

Public Member Functions

 UnmodifiableMapImpl (MapService< K, V > target)
 
void clear ()
 
boolean containsKey (Object key)
 
get (Object key)
 
Iterator< Entry< K, V > > iterator ()
 
Equality<? super K > keyComparator ()
 
put (K key, V value)
 
remove (Object key)
 
MapService< K, V > threadSafe ()
 
Equality<? super V > valueComparator ()
 
MapView< K, V > clone ()
 
boolean containsValue (Object value)
 
SetService< Entry< K, V > > entrySet ()
 
boolean isEmpty ()
 
SetService< K > keySet ()
 
void perform (Consumer< MapService< K, V >> action, MapService< K, V > view)
 
void perform (Consumer< T > action, T part)
 
void putAll (Map<? extends K, ? extends V > m)
 
putIfAbsent (K key, V value)
 
boolean remove (Object key, Object value)
 
replace (K key, V value)
 
boolean replace (K key, V oldValue, V newValue)
 
int size ()
 
MapService< K, V >[] split (int n)
 
void update (Consumer< MapService< K, V >> action, MapService< K, V > view)
 
void update (Consumer< T > action, T part)
 
CollectionService< V > values ()
 

Protected Member Functions

MapService< K, V > target ()
 

Private Attributes

MapService< K, V > target
 

Static Private Attributes

static final long serialVersionUID = 0x600L
 

Detailed Description

  • An unmodifiable view over a map.

Definition at line 19 of file UnmodifiableMapImpl.java.

Constructor & Destructor Documentation

◆ UnmodifiableMapImpl()

Member Function Documentation

◆ clear()

Reimplemented from javolution.util.internal.map.MapView< K, V >.

Definition at line 49 of file UnmodifiableMapImpl.java.

49  {
50  throw new UnsupportedOperationException("Unmodifiable");
51  }

◆ clone()

MapView<K, V> javolution.util.internal.map.MapView< K, V >.clone ( )
inherited

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

Implements javolution.util.service.MapService< K, V >.

Reimplemented in javolution.util.internal.map.AtomicMapImpl< K, V >, and javolution.util.internal.map.FastMapImpl< K, V >.

Definition at line 232 of file MapView.java.

232  {
233  try {
234  MapView<K, V> copy = (MapView<K, V>) super.clone();
235  if (target != null) { // Not a root class.
236  copy.target = target.clone();
237  }
238  return copy;
239  } catch (CloneNotSupportedException e) {
240  throw new Error("Should not happen since target is cloneable");
241  }
242  }

References javolution.util.internal.map.MapView< K, V >.clone(), and javolution.util.internal.map.MapView< K, V >.target.

Referenced by javolution.util.internal.map.MapView< K, V >.clone(), and javolution.util.internal.map.MapView< K, V >.split().

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

◆ containsKey()

boolean javolution.util.internal.map.UnmodifiableMapImpl< K, V >.containsKey ( Object  key)

Reimplemented from javolution.util.internal.map.MapView< K, V >.

Definition at line 54 of file UnmodifiableMapImpl.java.

54  {
55  return target().containsKey(key);
56  }

References javolution.util.internal.map.MapView< K, V >.target.

◆ containsValue()

boolean javolution.util.internal.map.MapView< K, V >.containsValue ( Object  value)
inherited

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 248 of file MapView.java.

248  {
249  return values().contains(value);
250  }

References javolution.util.internal.map.MapView< K, V >.values().

Here is the call graph for this function:

◆ entrySet()

SetService<Entry<K, V> > javolution.util.internal.map.MapView< K, V >.entrySet ( )
inherited

Returns a set view over the entries of this map. The set support adding/removing entries. Two entries are considered equals if they have the same key regardless of their values.

Implements javolution.util.service.MapService< K, V >.

Reimplemented in javolution.util.internal.map.sorted.SortedMapView< K, V >, javolution.util.internal.map.sorted.SharedSortedMapImpl< K, V >, javolution.util.internal.map.sorted.AtomicSortedMapImpl< K, V >, and javolution.util.internal.map.sorted.UnmodifiableSortedMapImpl< K, V >.

Definition at line 253 of file MapView.java.

253  {
254  return new EntrySet();
255  }

Referenced by javolution.util.internal.map.MapView< K, V >.KeySet.KeySet(), and javolution.util.internal.map.MapView< K, V >.Values.Values().

Here is the caller graph for this function:

◆ get()

V javolution.util.internal.map.UnmodifiableMapImpl< K, V >.get ( Object  key)

Reimplemented from javolution.util.internal.map.MapView< K, V >.

Definition at line 59 of file UnmodifiableMapImpl.java.

59  {
60  return target().get(key);
61  }

References javolution.util.internal.map.MapView< K, V >.target.

◆ isEmpty()

boolean javolution.util.internal.map.MapView< K, V >.isEmpty ( )
inherited

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 261 of file MapView.java.

261  {
262  return iterator().hasNext();
263  }

References javolution.util.internal.map.MapView< K, V >.iterator().

Referenced by javolution.util.internal.map.MapView< K, V >.EntrySet.isEmpty().

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

◆ iterator()

Iterator<Entry<K, V> > javolution.util.internal.map.UnmodifiableMapImpl< K, V >.iterator ( )

Returns an iterator over this map entries.

Reimplemented from javolution.util.internal.map.MapView< K, V >.

Definition at line 64 of file UnmodifiableMapImpl.java.

64  {
65  return new IteratorImpl();
66  }

◆ keyComparator()

Equality<? super K> javolution.util.internal.map.UnmodifiableMapImpl< K, V >.keyComparator ( )

Returns the key comparator used for key equality or order if the map is sorted.

Reimplemented from javolution.util.internal.map.MapView< K, V >.

Definition at line 69 of file UnmodifiableMapImpl.java.

69  {
70  return target().keyComparator();
71  }

References javolution.util.internal.map.MapView< K, V >.target.

◆ keySet()

SetService<K> javolution.util.internal.map.MapView< K, V >.keySet ( )
inherited

Returns a set view over the key of this map, the set support adding new key for which the value is automatically

null

.

Implements javolution.util.service.MapService< K, V >.

Reimplemented in javolution.util.internal.map.sorted.SortedMapView< K, V >, javolution.util.internal.map.sorted.SharedSortedMapImpl< K, V >, javolution.util.internal.map.sorted.AtomicSortedMapImpl< K, V >, and javolution.util.internal.map.sorted.UnmodifiableSortedMapImpl< K, V >.

Definition at line 272 of file MapView.java.

272  {
273  return new KeySet();
274  }

Referenced by javolution.util.FastSet< Index >.FastSet().

Here is the caller graph for this function:

◆ perform() [1/2]

void javolution.util.internal.map.MapView< K, V >.perform ( Consumer< MapService< K, V >>  action,
MapService< K, V >  view 
)
inherited

Reimplemented in javolution.util.internal.map.ParallelMapImpl< K, V >, and javolution.util.internal.map.SequentialMapImpl< K, V >.

Definition at line 277 of file MapView.java.

277  {
278  if (target == null) {
279  action.accept(view);
280  } else {
281  target.perform(action, view);
282  }
283  }

References javolution.util.internal.map.MapView< K, V >.target.

Referenced by javolution.util.internal.map.MapView< K, V >.EntrySet.perform().

Here is the caller graph for this function:

◆ perform() [2/2]

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.

◆ put()

V javolution.util.internal.map.UnmodifiableMapImpl< K, V >.put ( key,
value 
)

Reimplemented from javolution.util.internal.map.MapView< K, V >.

Definition at line 74 of file UnmodifiableMapImpl.java.

74  {
75  throw new UnsupportedOperationException("Unmodifiable");
76  }

◆ putAll()

void javolution.util.internal.map.MapView< K, V >.putAll ( Map<? extends K, ? extends V >  m)
inherited

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 290 of file MapView.java.

290  {
291  Iterator<?> it = m.entrySet().iterator();
292  while (it.hasNext()) {
293  Entry<K, V> e = (Entry<K, V>) it.next();
294  put(e.getKey(), e.getValue());
295  }
296  }

References javolution.util.internal.map.MapView< K, V >.put().

Referenced by javolution.util.internal.map.FastMapImpl< K, V >.clone().

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

◆ putIfAbsent()

V javolution.util.internal.map.MapView< K, V >.putIfAbsent ( key,
value 
)
inherited

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, javolution.util.internal.map.FastMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 299 of file MapView.java.

299  {
300  if (!containsKey(key)) return put(key, value);
301  else return get(key);
302  }

References javolution.util.internal.map.MapView< K, V >.containsKey(), and javolution.util.internal.map.MapView< K, V >.put().

Here is the call graph for this function:

◆ remove() [1/2]

V javolution.util.internal.map.UnmodifiableMapImpl< K, V >.remove ( Object  key)

Reimplemented from javolution.util.internal.map.MapView< K, V >.

Definition at line 79 of file UnmodifiableMapImpl.java.

79  {
80  throw new UnsupportedOperationException("Unmodifiable");
81  }

◆ remove() [2/2]

boolean javolution.util.internal.map.MapView< K, V >.remove ( Object  key,
Object  value 
)
inherited

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, javolution.util.internal.map.FastMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 308 of file MapView.java.

308  {
309  if (containsKey(key) && get(key).equals(value)) {
310  remove(key);
311  return true;
312  } else return false;
313  }

References javolution.util.internal.map.MapView< K, V >.containsKey().

Here is the call graph for this function:

◆ replace() [1/2]

boolean javolution.util.internal.map.MapView< K, V >.replace ( key,
oldValue,
newValue 
)
inherited

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, javolution.util.internal.map.FastMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 323 of file MapView.java.

323  {
324  if (containsKey(key) && get(key).equals(oldValue)) {
325  put(key, newValue);
326  return true;
327  } else return false;
328  }

References javolution.util.internal.map.MapView< K, V >.containsKey(), and javolution.util.internal.map.MapView< K, V >.put().

Here is the call graph for this function:

◆ replace() [2/2]

V javolution.util.internal.map.MapView< K, V >.replace ( key,
value 
)
inherited

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, javolution.util.internal.map.FastMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 316 of file MapView.java.

316  {
317  if (containsKey(key)) {
318  return put(key, value);
319  } else return null;
320  }

References javolution.util.internal.map.MapView< K, V >.containsKey(), and javolution.util.internal.map.MapView< K, V >.put().

Here is the call graph for this function:

◆ size()

int javolution.util.internal.map.MapView< K, V >.size ( )
inherited

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, javolution.util.internal.map.FastMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 331 of file MapView.java.

331  {
332  int count = 0;
333  Iterator<Entry<K, V>> it = iterator();
334  while (it.hasNext()) {
335  count++;
336  it.next();
337  }
338  return count;
339  }

References javolution.util.internal.map.MapView< K, V >.iterator().

Referenced by javolution.util.internal.map.sorted.FastSortedMapImpl< K, V >.put(), and javolution.util.internal.map.MapView< K, V >.EntrySet.size().

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

◆ split()

MapService<K, V> [] javolution.util.internal.map.MapView< K, V >.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

Implements javolution.util.function.Splittable< T >.

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, javolution.util.internal.map.FastMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 343 of file MapView.java.

343  {
344  if (target == null) return new MapService[] { this }; // No split.
345  MapService<K, V>[] subTargets = target.split(n);
346  MapService<K, V>[] result = new MapService[subTargets.length];
347  for (int i = 0; i < subTargets.length; i++) {
348  MapView<K, V> copy = this.clone();
349  copy.target = subTargets[i];
350  result[i] = copy;
351  }
352  return result;
353  }

References javolution.util.internal.map.MapView< K, V >.clone(), and javolution.util.internal.map.MapView< K, V >.target.

Referenced by javolution.util.internal.map.MapView< K, V >.EntrySet.split().

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

◆ target()

◆ threadSafe()

Returns a thread-safe version of this service (used during parallel updates).

Reimplemented from javolution.util.internal.map.MapView< K, V >.

Reimplemented in javolution.util.internal.map.sorted.UnmodifiableSortedMapImpl< K, V >.

Definition at line 84 of file UnmodifiableMapImpl.java.

84  {
85  return this;
86  }

◆ update() [1/2]

void javolution.util.internal.map.MapView< K, V >.update ( Consumer< MapService< K, V >>  action,
MapService< K, V >  view 
)
inherited

Reimplemented in javolution.util.internal.map.ParallelMapImpl< K, V >, javolution.util.internal.map.AtomicMapImpl< K, V >, and javolution.util.internal.map.SequentialMapImpl< K, V >.

Definition at line 361 of file MapView.java.

361  {
362  if (target == null) {
363  action.accept(view);
364  } else {
365  target.update(action, view);
366  }
367  }

References javolution.util.internal.map.MapView< K, V >.target.

Referenced by javolution.util.internal.map.MapView< K, V >.EntrySet.update().

Here is the caller graph for this function:

◆ update() [2/2]

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.

◆ valueComparator()

Equality<? super V> javolution.util.internal.map.UnmodifiableMapImpl< K, V >.valueComparator ( )

Returns the value comparator used for value equality.

Reimplemented from javolution.util.internal.map.MapView< K, V >.

Definition at line 89 of file UnmodifiableMapImpl.java.

89  {
90  return target().valueComparator();
91  }

References javolution.util.internal.map.MapView< K, V >.target.

◆ values()

Returns a collection view over the values of this map, the collection support value/entry removal but not adding new values.

Implements javolution.util.service.MapService< K, V >.

Definition at line 373 of file MapView.java.

373  {
374  return new Values();
375  }

Referenced by javolution.util.internal.map.MapView< K, V >.containsValue().

Here is the caller graph for this function:

Member Data Documentation

◆ serialVersionUID

final long javolution.util.internal.map.UnmodifiableMapImpl< K, V >.serialVersionUID = 0x600L
staticprivate

Definition at line 42 of file UnmodifiableMapImpl.java.

◆ target

MapService<K, V> javolution.util.internal.map.MapView< K, V >.target
privateinherited

Reimplemented in javolution.util.internal.map.sorted.SortedMapView< K, V >, javolution.util.internal.map.sorted.SharedSortedMapImpl< K, V >, and javolution.util.internal.map.sorted.UnmodifiableSortedMapImpl< K, V >.

Definition at line 213 of file MapView.java.

Referenced by javolution.util.internal.map.AtomicMapImpl< K, V >.AtomicMapImpl(), javolution.util.internal.map.sorted.AtomicSortedMapImpl< K, V >.AtomicSortedMapImpl(), javolution.util.internal.map.SharedMapImpl< K, V >.clear(), javolution.util.internal.map.MapView< K, V >.clone(), javolution.util.internal.map.AtomicMapImpl< K, V >.cloneTarget(), javolution.util.internal.map.SharedMapImpl< K, V >.cloneTarget(), javolution.util.internal.map.sorted.AtomicSortedMapImpl< K, V >.comparator(), javolution.util.internal.map.SequentialMapImpl< K, V >.containsKey(), javolution.util.internal.map.ParallelMapImpl< K, V >.containsKey(), javolution.util.internal.map.UnmodifiableMapImpl< K, V >.containsKey(), javolution.util.internal.map.SharedMapImpl< K, V >.containsKey(), javolution.util.internal.map.SharedMapImpl< K, V >.containsValue(), javolution.util.internal.map.SequentialMapImpl< K, V >.get(), javolution.util.internal.map.ParallelMapImpl< K, V >.get(), javolution.util.internal.map.UnmodifiableMapImpl< K, V >.get(), javolution.util.internal.map.SharedMapImpl< K, V >.get(), javolution.util.internal.map.SharedMapImpl< K, V >.isEmpty(), javolution.util.internal.map.SequentialMapImpl< K, V >.iterator(), javolution.util.internal.map.ParallelMapImpl< K, V >.iterator(), javolution.util.internal.map.SequentialMapImpl< K, V >.keyComparator(), javolution.util.internal.map.ParallelMapImpl< K, V >.keyComparator(), javolution.util.internal.map.UnmodifiableMapImpl< K, V >.keyComparator(), javolution.util.internal.map.SharedMapImpl< K, V >.keyComparator(), javolution.util.internal.map.MapView< K, V >.MapView(), javolution.util.internal.map.ParallelMapImpl< K, V >.ParallelMapImpl(), javolution.util.internal.map.ParallelMapImpl< K, V >.perform(), javolution.util.internal.map.MapView< K, V >.perform(), javolution.util.internal.map.SequentialMapImpl< K, V >.put(), javolution.util.internal.map.ParallelMapImpl< K, V >.put(), javolution.util.internal.map.AtomicMapImpl< K, V >.put(), javolution.util.internal.map.SharedMapImpl< K, V >.put(), javolution.util.internal.map.AtomicMapImpl< K, V >.putAll(), javolution.util.internal.map.SharedMapImpl< K, V >.putAll(), javolution.util.internal.map.AtomicMapImpl< K, V >.putIfAbsent(), javolution.util.internal.map.SharedMapImpl< K, V >.putIfAbsent(), javolution.util.internal.map.SequentialMapImpl< K, V >.remove(), javolution.util.internal.map.ParallelMapImpl< K, V >.remove(), javolution.util.internal.map.AtomicMapImpl< K, V >.remove(), javolution.util.internal.map.SharedMapImpl< K, V >.remove(), javolution.util.internal.map.AtomicMapImpl< K, V >.replace(), javolution.util.internal.map.SharedMapImpl< K, V >.replace(), javolution.util.internal.map.SequentialMapImpl< K, V >.SequentialMapImpl(), javolution.util.internal.map.SharedMapImpl< K, V >.SharedMapImpl(), javolution.util.internal.map.SharedMapImpl< K, V >.size(), javolution.util.internal.map.SharedMapImpl< K, V >.split(), javolution.util.internal.map.MapView< K, V >.split(), javolution.util.internal.map.MapView< K, V >.target(), javolution.util.internal.map.AtomicMapImpl< K, V >.targetView(), javolution.util.internal.map.UnmodifiableMapImpl< K, V >.UnmodifiableMapImpl(), javolution.util.internal.map.ParallelMapImpl< K, V >.update(), javolution.util.internal.map.AtomicMapImpl< K, V >.update(), javolution.util.internal.map.MapView< K, V >.update(), javolution.util.internal.map.SequentialMapImpl< K, V >.valueComparator(), javolution.util.internal.map.UnmodifiableMapImpl< K, V >.valueComparator(), javolution.util.internal.map.ParallelMapImpl< K, V >.valueComparator(), and javolution.util.internal.map.SharedMapImpl< K, V >.valueComparator().


The documentation for this class was generated from the following file:
javolution.util.internal.map.MapView.iterator
abstract Iterator< Entry< K, V > > iterator()
javolution.util.internal.map.MapView.put
abstract V put(K key, V value)
javolution.util.internal.map.MapView.containsKey
abstract boolean containsKey(Object key)
javolution.util.internal.map.MapView.clone
MapView< K, V > clone()
Definition: MapView.java:232
javolution.util.internal.map.MapView.values
CollectionService< V > values()
Definition: MapView.java:373
EntrySet
javolution.util.internal.map.MapView.target
MapService< K, V > target
Definition: MapView.java:213