org.semanticdesktop.aperture.util
Class ArrayMap

java.lang.Object
  extended by org.semanticdesktop.aperture.util.ArrayMap
All Implemented Interfaces:
Map

public class ArrayMap
extends Object
implements Map

A simple Map implementation, taking roughly the same strategy as ArrayList, resulting in a memory-efficient and (for small amounts of key-value pairs) fast implementation.

Please note that methods like containsKey, get, etc. test on object identity (i.e. key == keys[i]), rather than using Object.equals.


Nested Class Summary
 class ArrayMap.Entry
           
 
Constructor Summary
ArrayMap()
           
ArrayMap(int initialCapacity)
           
ArrayMap(Map map)
           
 
Method Summary
 void clear()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Set entrySet()
           
 boolean equals(Object object)
           
 Object get(Object key)
           
 Object getKey(int index)
           
 Object getValue(int index)
           
 int hashCode()
           
 boolean isEmpty()
           
 Set keySet()
           
 Object put(Object key, Object value)
           
 void putAll(Map map)
           
 Object remove(Object key)
           
 int size()
           
 String toString()
           
 Collection values()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArrayMap

public ArrayMap()

ArrayMap

public ArrayMap(int initialCapacity)

ArrayMap

public ArrayMap(Map map)
Method Detail

clear

public void clear()
Specified by:
clear in interface Map

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map

equals

public boolean equals(Object object)
Specified by:
equals in interface Map
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

get

public Object get(Object key)
Specified by:
get in interface Map

hashCode

public int hashCode()
Specified by:
hashCode in interface Map
Overrides:
hashCode in class Object

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map

keySet

public Set keySet()
Specified by:
keySet in interface Map

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface Map

putAll

public void putAll(Map map)
Specified by:
putAll in interface Map

remove

public Object remove(Object key)
Specified by:
remove in interface Map

size

public int size()
Specified by:
size in interface Map

values

public Collection values()
Specified by:
values in interface Map

getKey

public Object getKey(int index)

getValue

public Object getValue(int index)


Copyright © 2010 Aperture Development Team. All Rights Reserved.