@Override public synchronized boolean remove(Object key, Object value) { ArrayHolder<K, V> current = this.holder; int index = current.find((K) key); if (index >= 0 && current.entries[index].getValue().equals(value)) { this.holder = current.remove(index); return true; } return false; }
@Override public synchronized boolean replace(K key, V oldValue, V newValue) { ArrayHolder<K, V> current = this.holder; int index = current.find(key); if (index >= 0 && current.entries[index].getValue().equals(oldValue)) { COWEntry<K, V> newEntry = new COWEntry<>(key, newValue); this.holder = current.replace(index, newEntry); return true; } return false; }
@Override public synchronized boolean remove(Object key, Object value) { ArrayHolder<K, V> current = this.holder; int index = current.find((K) key); if (index >= 0 && current.entries[index].getValue().equals(value)) { this.holder = current.remove(index); return true; } return false; }
@Override public V next() { return holder.entries[index++].getValue(); }
@Override public synchronized V replace(K key, V value) { ArrayHolder<K, V> current = this.holder; int index = current.find(key); if (index >= 0) { COWEntry<K, V> newEntry = new COWEntry<>(key, value); this.holder = current.replace(index, newEntry); return current.entries[index].getValue(); } return null; }
@Override public V get(Object key) { ArrayHolder<K, V> current = this.holder; int index = current.find((K) key); if (index >= 0) { return current.entries[index].getValue(); } return null; }
@Override public synchronized boolean remove(Object key, Object value) { ArrayHolder<K, V> current = this.holder; int index = current.find((K) key); if (index >= 0 && current.entries[index].getValue().equals(value)) { this.holder = current.remove(index); return true; } return false; }
@Override public V get(Object key) { ArrayHolder<K, V> current = this.holder; int index = current.find((K) key); if (index >= 0) { return current.entries[index].getValue(); } return null; }
@Override public synchronized V putIfAbsent(K key, V value) { ArrayHolder<K, V> current = this.holder; int index = current.find(key); if (index < 0) { COWEntry<K, V> newEntry = new COWEntry<>(key, value); this.holder = current.insert(-(index + 1), newEntry); return value; } return current.entries[index].getValue(); }
@Override public synchronized boolean replace(K key, V oldValue, V newValue) { ArrayHolder<K, V> current = this.holder; int index = current.find(key); if (index >= 0 && current.entries[index].getValue().equals(oldValue)) { COWEntry<K, V> newEntry = new COWEntry<>(key, newValue); this.holder = current.replace(index, newEntry); return true; } return false; }
@Override public synchronized V putIfAbsent(K key, V value) { ArrayHolder<K, V> current = this.holder; int index = current.find(key); if (index < 0) { COWEntry<K, V> newEntry = new COWEntry<>(key, value); this.holder = current.insert(-(index + 1), newEntry); return value; } return current.entries[index].getValue(); }
@Override public synchronized V remove(Object key) { ArrayHolder<K, V> current = this.holder; int index = current.find((K) key); if (index >= 0) { this.holder = current.remove(index); return current.entries[index].getValue(); } return null; }
@Override public synchronized V put(K key, V value) { ArrayHolder<K, V> current = this.holder; int index = current.find(key); COWEntry<K, V> newEntry = new COWEntry<>(key, value); if (index >= 0) { this.holder = current.replace(index, newEntry); return current.entries[index].getValue(); } else { this.holder = current.insert(-(index + 1), newEntry); } return null; }
@Override public synchronized V putIfAbsent(K key, V value) { ArrayHolder<K, V> current = this.holder; int index = current.find(key); if (index < 0) { COWEntry<K, V> newEntry = new COWEntry<>(key, value); this.holder = current.insert(-(index + 1), newEntry); return value; } return current.entries[index].getValue(); }
@Override public V next() { return holder.entries[index++].getValue(); }
@Override public synchronized V replace(K key, V value) { ArrayHolder<K, V> current = this.holder; int index = current.find(key); if (index >= 0) { COWEntry<K, V> newEntry = new COWEntry<>(key, value); this.holder = current.replace(index, newEntry); return current.entries[index].getValue(); } return null; }
@Override public V get(Object key) { ArrayHolder<K, V> current = this.holder; int index = current.find((K) key); if (index >= 0) { return current.entries[index].getValue(); } return null; }
@Override public synchronized V put(K key, V value) { ArrayHolder<K, V> current = this.holder; int index = current.find(key); COWEntry<K, V> newEntry = new COWEntry<>(key, value); if (index >= 0) { this.holder = current.replace(index, newEntry); return current.entries[index].getValue(); } else { this.holder = current.insert(-(index + 1), newEntry); } return null; }
@Override public synchronized V putIfAbsent(K key, V value) { ArrayHolder<K, V> current = this.holder; int index = current.find(key); if (index < 0) { COWEntry<K, V> newEntry = new COWEntry<>(key, value); this.holder = current.insert(-(index + 1), newEntry); return value; } return current.entries[index].getValue(); }
@Override public synchronized V remove(Object key) { ArrayHolder<K, V> current = this.holder; int index = current.find((K) key); if (index >= 0) { this.holder = current.remove(index); return current.entries[index].getValue(); } return null; }