Go to the documentation of this file.
9 package javolution.util.internal.map;
11 import java.io.Serializable;
12 import java.util.Iterator;
42 public boolean areEqual(Entry<K, V> left, Entry<K, V> right) {
48 public int compare(Entry<K, V> left, Entry<K, V> right) {
67 public boolean add(Entry<K, V> entry) {
68 put(entry.getKey(), entry.getValue());
77 @SuppressWarnings(
"unchecked")
80 if (obj instanceof Entry) {
81 Entry<K, V> e = (Entry<K, V>) obj;
111 @SuppressWarnings(
"unchecked")
113 if (obj instanceof Entry) {
114 Entry<K, V> e = (Entry<K, V>) obj;
115 if (!
contains(e.getKey()))
return false;
127 @SuppressWarnings(
"unchecked")
132 for (
int i = 0; i < result.length; i++) {
159 public K apply(Map.Entry<K, V> e) {
167 public boolean add(K key) {
178 @SuppressWarnings(
"unchecked")
184 @SuppressWarnings(
"unchecked")
186 public boolean remove(Object obj) {
200 public V apply(Map.Entry<K, V> e) {
224 Iterator<Entry<K, V>> it =
iterator();
225 while (it.hasNext()) {
230 @SuppressWarnings(
"unchecked")
239 }
catch (CloneNotSupportedException e) {
240 throw new Error(
"Should not happen since target is cloneable");
249 return values().contains(value);
258 public abstract V
get(Object key);
281 target.perform(action, view);
286 public abstract V
put(K key, V value);
288 @SuppressWarnings(
"unchecked")
290 public void putAll(Map<? extends K, ? extends V> m) {
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());
301 else return get(key);
305 public abstract V
remove(Object key);
308 public boolean remove(Object key, Object value) {
318 return put(key, value);
323 public boolean replace(K key, V oldValue, V newValue) {
324 if (
containsKey(key) &&
get(key).equals(oldValue)) {
333 Iterator<Entry<K, V>> it =
iterator();
334 while (it.hasNext()) {
341 @SuppressWarnings(
"unchecked")
347 for (
int i = 0; i < subTargets.length; i++) {
349 copy.
target = subTargets[i];
365 target.update(action, view);
SetService< Map.Entry< K, V > > entrySet()
boolean areEqual(T left, T right)
static final long serialVersionUID
Equality<? super K > comparator()
abstract Iterator< Entry< K, V > > iterator()
void update(final Consumer< CollectionService< Entry< K, V >>> action, final CollectionService< Entry< K, V >> view)
void perform(Consumer< MapService< K, V >> action, MapService< K, V > view)
boolean contains(Object obj)
boolean containsValue(Object value)
int hashCodeOf(Entry< K, V > e)
boolean remove(Object obj)
Equality<? super V > comparator()
abstract V put(K key, V value)
static final long serialVersionUID
MapService< K, V > threadSafe()
boolean replace(K key, V oldValue, V newValue)
static final long serialVersionUID
boolean areEqual(Entry< K, V > left, Entry< K, V > right)
CollectionService< Entry< K, V > >[] split(int n)
MapService< K, V > target()
MapView(MapService< K, V > target)
static final long serialVersionUID
abstract boolean containsKey(Object key)
void update(Consumer< MapService< K, V >> action, MapService< K, V > view)
SetService< Entry< K, V > > entrySet()
abstract V remove(Object key)
CollectionService< V > values()
void perform(final Consumer< CollectionService< Entry< K, V >>> action, final CollectionService< Entry< K, V >> view)
int compare(T left, T right)
abstract Equality<? super V > valueComparator()
static final long serialVersionUID
Iterator< Entry< K, V > > iterator()
int compare(Entry< K, V > left, Entry< K, V > right)
V putIfAbsent(K key, V value)
void putAll(Map<? extends K, ? extends V > m)
MapService< K, V >[] split(int n)
boolean contains(Object obj)
V replace(K key, V value)
abstract Equality<? super K > keyComparator()
boolean add(Entry< K, V > entry)
Equality<? super Entry< K, V > > comparator()
MapService< K, V > target