Go to the documentation of this file.
9 package javolution.util.internal.map;
11 import java.util.Iterator;
12 import java.util.NoSuchElementException;
57 @SuppressWarnings(
"unchecked")
63 @SuppressWarnings(
"unchecked")
65 public V
get(Object key) {
68 if (entry ==
null)
return null;
74 return new Iterator<Entry<K, V>>() {
79 public boolean hasNext() {
80 return (next !=
null);
84 public java.util.Map.Entry<K, V> next() {
85 if (next ==
null)
throw new NoSuchElementException();
92 public void remove() {
93 if (current ==
null)
throw new IllegalStateException();
107 @SuppressWarnings(
"unchecked")
109 public V
put(K key, V value) {
119 V oldValue = (V) tmp.
value;
125 @SuppressWarnings(
"unchecked")
137 return (V) tmp.
value;
141 @SuppressWarnings(
"unchecked")
143 public V
remove(Object key) {
146 if (entry ==
null)
return null;
152 @SuppressWarnings(
"unchecked")
154 public boolean remove(Object key, Object value) {
157 if (entry ==
null)
return false;
165 @SuppressWarnings(
"unchecked")
170 if (entry ==
null)
return null;
171 V oldValue = entry.
value;
176 @SuppressWarnings(
"unchecked")
178 public boolean replace(K key, V oldValue, V newValue) {
181 if (entry ==
null)
return false;
183 entry.
value = newValue;
192 @SuppressWarnings(
"unchecked")
223 if (previous !=
null) {
224 previous.
next = next;
232 @SuppressWarnings(
"unchecked")
234 throws java.io.IOException, ClassNotFoundException {
235 s.defaultReadObject();
239 for (
int i = 0; i < n; i++) {
240 put((K) s.readObject(), (V) s.readObject());
246 throws java.io.IOException {
247 s.defaultWriteObject();
249 Iterator<Entry<K, V>> it =
iterator();
250 while (it.hasNext()) {
251 Entry<K, V> e = it.next();
252 s.writeObject(e.getKey());
253 s.writeObject(e.getValue());
boolean areEqual(T left, T right)
MapEntryImpl removeEntry(Object key, int hash)
transient MapEntryImpl< K, V > firstEntry
transient MapEntryImpl< K, V > lastEntry
transient FractalMapImpl fractal
static final long serialVersionUID
void detachEntry(MapEntryImpl< K, V > entry)
void attachEntry(MapEntryImpl< K, V > entry)
Equality<? super V > valueComparator()
transient MapEntryImpl< K, V > freeEntry
boolean replace(K key, V oldValue, V newValue)
MapEntryImpl addEntry(MapEntryImpl newEntry, Object key, int hash)
V putIfAbsent(K key, V value)
FastMapImpl< K, V > clone()
final Equality<? super V > valueComparator
FastMapImpl(Equality<? super K > keyComparator, final Equality<? super V > valueComparator)
void readObject(java.io.ObjectInputStream s)
MapEntryImpl< K, V > next
final Equality<? super K > keyComparator
MapService< K, V >[] split(int n)
void putAll(Map<? extends K, ? extends V > m)
MapEntryImpl getEntry(Object key, int hash)
MapEntryImpl< K, V > previous
Equality<? super K > keyComparator()
void writeObject(java.io.ObjectOutputStream s)
Iterator< Entry< K, V > > iterator()
boolean containsKey(Object key)
V replace(K key, V value)