org.eclipse.osgi.internal.baseadaptor
Class ArrayMap<K,V>

java.lang.Object
  extended by org.eclipse.osgi.internal.baseadaptor.ArrayMap<K,V>
Type Parameters:
K - The key type
V - the value type
All Implemented Interfaces:
java.lang.Iterable<K>, java.util.Collection<K>

public class ArrayMap<K,V>
extends java.lang.Object
implements java.util.Collection<K>

Simple map when dealing with small amounts of entries. This class also provides a Collections view of the keys


Constructor Summary
ArrayMap(int initialCapacity)
           
ArrayMap(java.util.List<K> keys, java.util.List<V> values)
          Note that the keys and values are not copied.
 
Method Summary
 boolean add(K o)
           
 boolean addAll(java.util.Collection<? extends K> c)
           
 void clear()
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection<?> c)
           
 V get(K key)
           
 K getKey(int index)
           
 java.util.List<K> getKeys()
           
 V getValue(int index)
           
 java.util.List<V> getValues()
           
 boolean isEmpty()
           
 java.util.Iterator<K> iterator()
           
 void put(K key, V value)
           
 boolean remove(java.lang.Object key)
           
 boolean removeAll(java.util.Collection<?> c)
           
 boolean retainAll(java.util.Collection<?> c)
           
 int size()
           
 java.lang.Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

ArrayMap

public ArrayMap(int initialCapacity)

ArrayMap

public ArrayMap(java.util.List<K> keys,
                java.util.List<V> values)
Note that the keys and values are not copied. Changes to this ArrayMap will change the values of the keys and values Lists.

Parameters:
keys -
values -
Method Detail

get

public V get(K key)

put

public void put(K key,
                V value)

remove

public boolean remove(java.lang.Object key)
Specified by:
remove in interface java.util.Collection<K>

clear

public void clear()
Specified by:
clear in interface java.util.Collection<K>

getKeys

public java.util.List<K> getKeys()

getValues

public java.util.List<V> getValues()

size

public int size()
Specified by:
size in interface java.util.Collection<K>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<K>

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection<K>

iterator

public java.util.Iterator<K> iterator()
Specified by:
iterator in interface java.lang.Iterable<K>
Specified by:
iterator in interface java.util.Collection<K>

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<K>

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface java.util.Collection<K>

add

public boolean add(K o)
Specified by:
add in interface java.util.Collection<K>

containsAll

public boolean containsAll(java.util.Collection<?> c)
Specified by:
containsAll in interface java.util.Collection<K>

addAll

public boolean addAll(java.util.Collection<? extends K> c)
Specified by:
addAll in interface java.util.Collection<K>

removeAll

public boolean removeAll(java.util.Collection<?> c)
Specified by:
removeAll in interface java.util.Collection<K>

retainAll

public boolean retainAll(java.util.Collection<?> c)
Specified by:
retainAll in interface java.util.Collection<K>

getKey

public K getKey(int index)

getValue

public V getValue(int index)


Copyright © 2007-2012 FuseSource, Corp.. All Rights Reserved.