org.jboss.cache.util
Class MapCopy<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by org.jboss.cache.util.MapCopy<K,V>
All Implemented Interfaces:
Serializable, Map<K,V>

@Immutable
public class MapCopy<K,V>
extends AbstractMap<K,V>
implements Serializable

Contains a fixed array of read-only map entries, from a copy of an existing map. This class is more lightweight for places where the copied map will just be iterated over.

This map is strictly read-only, and map modification methods (as well as modifications over iterators) will throw UnsupportedOperationExceptions.

Author:
Elias Ross
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
MapCopy()
           
MapCopy(Map<K,V> m)
          Copies the supplied map to an internal array.
 
Method Summary
static
<L,W> Map<L,W>
copy(Map<L,W> m)
          Returns a copy of the given map.
 Set<Map.Entry<K,V>> entrySet()
           
 int size()
           
 
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapCopy

public MapCopy(Map<K,V> m)
Copies the supplied map to an internal array.

Parameters:
m - map to copy

MapCopy

public MapCopy()
Method Detail

copy

public static <L,W> Map<L,W> copy(Map<L,W> m)
Returns a copy of the given map.


entrySet

public Set<Map.Entry<K,V>> entrySet()
Specified by:
entrySet in interface Map<K,V>
Specified by:
entrySet in class AbstractMap<K,V>

size

public int size()
Specified by:
size in interface Map<K,V>
Overrides:
size in class AbstractMap<K,V>


Copyright © 2008 JBoss, a division of Red Hat. All Rights Reserved.