org.antlr.runtime.misc
Class DoubleKeyMap<Key1,Key2,Value>

java.lang.Object
  extended by org.antlr.runtime.misc.DoubleKeyMap<Key1,Key2,Value>

public class DoubleKeyMap<Key1,Key2,Value>
extends Object

Sometimes we need to map a key to a value but key is two pieces of data. This nested hash table saves creating a single key each time we access map; avoids mem creation.


Constructor Summary
DoubleKeyMap()
           
 
Method Summary
 Map<Key2,Value> get(Key1 k1)
           
 Value get(Key1 k1, Key2 k2)
           
 Set<Key1> keySet()
          get all primary keys
 Set<Key2> keySet(Key1 k1)
          get all secondary keys associated with a primary key
 Value put(Key1 k1, Key2 k2, Value v)
           
 Collection<Value> values()
           
 Collection<Value> values(Key1 k1)
          Get all values associated with primary key
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleKeyMap

public DoubleKeyMap()
Method Detail

put

public Value put(Key1 k1,
                 Key2 k2,
                 Value v)

get

public Value get(Key1 k1,
                 Key2 k2)

get

public Map<Key2,Value> get(Key1 k1)

values

public Collection<Value> values(Key1 k1)
Get all values associated with primary key


keySet

public Set<Key1> keySet()
get all primary keys


keySet

public Set<Key2> keySet(Key1 k1)
get all secondary keys associated with a primary key


values

public Collection<Value> values()


Copyright © 2011. All Rights Reserved.