@Override public MapIterator<MultiKey<? extends K>, V> mapIterator() { return decorated().mapIterator(); }
/** * Gets an iterator over the map. * Changes made to the iterator affect this map. * <p> * A MapIterator returns the keys in the map. It also provides convenient * methods to get the key and value, and set the value. * It avoids the need to create an entrySet/keySet/values object. * It also avoids creating the Map Entry object. * * @return the map iterator */ @Override public MapIterator<K, V> mapIterator() { if (delegateMap != null) { return delegateMap.mapIterator(); } if (size == 0) { return EmptyMapIterator.<K, V>emptyMapIterator(); } return new FlatMapIterator<>(this); }
buf.append('{'); final MapIterator<K, V> it = mapIterator(); boolean hasNext = it.hasNext(); while (hasNext) {
/** * Writes the map data to the stream. This method must be overridden if a * subclass must be setup before <code>put()</code> is used. * <p> * Serialization is not one of the JDK's nicest topics. Normal serialization will * initialise the superclass before the subclass. Sometimes however, this isn't * what you want, as in this case the <code>put()</code> method on read can be * affected by subclass state. * <p> * The solution adopted here is to serialize the state data of this class in * this protected method. This method must be called by the * <code>writeObject()</code> of the first serializable subclass. * <p> * Subclasses may override if they have a specific field that must be present * on read before this implementation will work. Generally, the read determines * what must be serialized here, if anything. * * @param out the output stream * @throws IOException if an error occurs while writing tothe stream */ protected void doWriteObject(final ObjectOutputStream out) throws IOException { out.writeFloat(loadFactor); out.writeInt(data.length); out.writeInt(size); for (final MapIterator<K, V> it = mapIterator(); it.hasNext();) { out.writeObject(it.next()); out.writeObject(it.getValue()); } }
return false; final MapIterator<?,?> it = mapIterator(); try { while (it.hasNext()) {
private MapIterator<Key, Value> removeFromMapToEmit(MapIterator<Key, Value> iterCache) { if (urm) { if (iterCache == null) iterCache = cache.mapIterator(); iterCache.next(); emitKey = iterCache.getKey(); emitValue = iterCache.getValue(); iterCache.remove(); return iterCache; } else { emitKey = ((LRUMap<Key,Value>)cache).firstKey(); // LRU emitValue = cache.remove(emitKey); return null; } }