Top Description Inners Fields Constructors Methods
org.eclipse.xtext.xbase.lib.internal

public Class UnmodifiableMergingMapView<K, V>

extends AbstractMap<K, V>
Class Inheritance
Annotations
@GwtCompatible
Type Parameters
<K>
the type of the keys.
<V>
the type of the values in the maps.
Imports
java.util.AbstractMap, .AbstractSet, .Iterator, .Map, .Set, java.util.function.BiFunction, com.google.common.annotations.GwtCompatible, com.google.common.base.Predicate, com.google.common.collect.Iterators

Map implementation that is merging two maps.

If a key exists within the two merged maps, then the retained value is the one of the right map.

Author
Stephane Galland - Initial contribution and API
Since
2.15

Nested and Inner Type Summary

Modifier and TypeClass and Description
private abstract static class
UnmodifiableMergingMapView.AbstractEarlyFailingSet<
the type of the set elements.
T
>

Abstract implements of a set that is failing as soon as possible when modifiers are called.

Field Summary

Modifier and TypeField and Description
private final Map<? extends K, ? extends V>
private final Map<? extends K, ? extends V>

Constructor Summary

AccessConstructor and Description
public
UnmodifiableMergingMapView(Map<? extends K, ? extends V>
the left operand to merge.
left
,
Map<? extends K, ? extends V>
the right operand to merge.
right
)

Construct the wrapping map.

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Overrides java.util.AbstractMap.clear.

Implements java.util.Map.clear.

Removes all of the mappings from this map (optional operation).

private static <K, V> Set<Map.Entry<K, V>>
difference(final Map<? extends K, ? extends V> left, final Map<? extends K, ? extends V> right)

public Set<Map.Entry<K, V>>
entrySet()

Implements abstract java.util.AbstractMap.entrySet.

Implements java.util.Map.entrySet.

Returns a Set view of the mappings contained in this map.

public V
put(K key, V value)

Overrides java.util.AbstractMap.put.

Implements java.util.Map.put.

Associates the specified value with the specified key in this map (optional operation).

public V
remove(Object key)

Overrides java.util.AbstractMap.remove.

Implements java.util.Map.remove.

Removes the mapping for a key from this map if it is present (optional operation).

public void
replaceAll(BiFunction<? super K, ? super V, ? extends V> function)

Overrides default java.util.Map.replaceAll.

Replaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception (optional operation).

Inherited from java.util.AbstractMap:
clonecontainsKeycontainsValueequalsgethashCodeisEmptykeySetputAllsizetoStringvalues

Field Detail

leftback to summary
private final Map<? extends K, ? extends V> left

Constructor Detail

UnmodifiableMergingMapViewback to summary
public UnmodifiableMergingMapView(Map<? extends K, ? extends V> left, Map<? extends K, ? extends V> right)

Construct the wrapping map.

Parameters
left:Map<? extends K, ? extends V>

the left operand to merge.

right:Map<? extends K, ? extends V>

the right operand to merge.

Method Detail

clearback to summary
public void clear()

Overrides java.util.AbstractMap.clear.

Implements java.util.Map.clear.

Doc from java.util.AbstractMap.clear.

Removes all of the mappings from this map (optional operation). The map will be empty after this call returns.

Annotations
@Override
differenceback to summary
private static <K, V> Set<Map.Entry<K, V>> difference(final Map<? extends K, ? extends V> left, final Map<? extends K, ? extends V> right)
entrySetback to summary
public Set<Map.Entry<K, V>> entrySet()

Implements abstract java.util.AbstractMap.entrySet.

Implements java.util.Map.entrySet.

Doc from java.util.Map.entrySet.

Returns a Set view of the mappings contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation, or through the setValue operation on a map entry returned by the iterator) the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.

Annotations
@Override
putback to summary
public V put(K key, V value)

Overrides java.util.AbstractMap.put.

Implements java.util.Map.put.

Doc from java.util.AbstractMap.put.

Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for the key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.)

Annotations
@Override
removeback to summary
public V remove(Object key)

Overrides java.util.AbstractMap.remove.

Implements java.util.Map.remove.

Doc from java.util.AbstractMap.remove.

Removes the mapping for a key from this map if it is present (optional operation). More formally, if this map contains a mapping from key k to value v such that Objects.equals(key, k), that mapping is removed. (The map can contain at most one such mapping.)

Returns the value to which this map previously associated the key, or null if the map contained no mapping for the key.

If this map permits null values, then a return value of null does not necessarily indicate that the map contained no mapping for the key; it's also possible that the map explicitly mapped the key to null.

The map will not contain a mapping for the specified key once the call returns.

Annotations
@Override
replaceAllback to summary
public void replaceAll(BiFunction<? super K, ? super V, ? extends V> function)

Overrides default java.util.Map.replaceAll.

Doc from java.util.Map.replaceAll.

Replaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception (optional operation). Exceptions thrown by the function are relayed to the caller.

Annotations
@Override
org.eclipse.xtext.xbase.lib.internal back to summary

private abstract Class UnmodifiableMergingMapView.AbstractEarlyFailingSet<T>

extends AbstractSet<T>
Class Inheritance
Annotations
@GwtCompatible
Type Parameters
<T>
the type of the set elements.

Abstract implements of a set that is failing as soon as possible when modifiers are called.
Author
$Author: sgalland$
Version
$FullVersion$

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
add(T entry)

Overrides java.util.AbstractCollection.add.

Implements java.util.Set.add, java.util.Collection.add.

Adds the specified element to this set if it is not already present (optional operation).

public void
clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Removes all of the elements from this set (optional operation).

public boolean
remove(Object element)

Overrides java.util.AbstractCollection.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Removes the specified element from this set if it is present (optional operation).

Inherited from java.util.AbstractSet:
equalshashCoderemoveAll

Constructor Detail

AbstractEarlyFailingSetback to summary
pack-priv AbstractEarlyFailingSet()

Method Detail

addback to summary
public boolean add(T entry)

Overrides java.util.AbstractCollection.add.

Implements java.util.Set.add, java.util.Collection.add.

Doc from java.util.Set.add.

Adds the specified element to this set if it is not already present (optional operation). More formally, adds the specified element e to this set if the set contains no element e2 such that Objects.equals(e, e2). If this set already contains the element, the call leaves the set unchanged and returns false. In combination with the restriction on constructors, this ensures that sets never contain duplicate elements.

The stipulation above does not imply that sets must accept all elements; sets may refuse to add any particular element, including null, and throw an exception, as described in the specification for Collection.add. Individual set implementations should clearly document any restrictions on the elements that they may contain.

Annotations
@Override
clearback to summary
public void clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Doc from java.util.Set.clear.

Removes all of the elements from this set (optional operation). The set will be empty after this call returns.

Annotations
@Override
removeback to summary
public boolean remove(Object element)

Overrides java.util.AbstractCollection.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Doc from java.util.Set.remove.

Removes the specified element from this set if it is present (optional operation). More formally, removes an element e such that Objects.equals(o, e), if this set contains such an element. Returns true if this set contained the element (or equivalently, if this set changed as a result of the call). (This set will not contain the element once the call returns.)

Annotations
@Override