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:
Iterable<K>, Collection<K>, Sortable<K>

public class ArrayMap<K,V>
extends Object
implements Collection<K>, Sortable<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(List<K> keys, List<V> values)
          Note that the keys and values are not copied.
 
Method Summary
 boolean add(K o)
           
 boolean addAll(Collection<? extends K> c)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> c)
           
 V get(K key)
           
 K getKey(int index)
           
 List<K> getKeys()
           
 V getValue(int index)
           
 List<V> getValues()
           
 boolean isEmpty()
           
 Iterator<K> iterator()
           
 void put(K key, V value)
           
 boolean remove(Object key)
           
 boolean removeAll(Collection<?> c)
           
 boolean retainAll(Collection<?> c)
           
 int size()
           
 void sort(Comparator<K> comparator)
          Sorts collection of elements represented by this sortable according to the specified comparator.
 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(List<K> keys,
                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(Object key)
Specified by:
remove in interface Collection<K>

clear

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

getKeys

public List<K> getKeys()

getValues

public List<V> getValues()

size

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

isEmpty

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

contains

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

iterator

public Iterator<K> iterator()
Specified by:
iterator in interface Iterable<K>
Specified by:
iterator in interface Collection<K>

toArray

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

toArray

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

add

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

containsAll

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

addAll

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

removeAll

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

retainAll

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

getKey

public K getKey(int index)

getValue

public V getValue(int index)

sort

public void sort(Comparator<K> comparator)
Description copied from interface: Sortable
Sorts collection of elements represented by this sortable according to the specified comparator.

Specified by:
sort in interface Sortable<K>
Parameters:
comparator - the comparator used to sort the collection of elements represented by this sortable.


Copyright © 2007–2014 The Apache Software Foundation. All rights reserved.