you can use the Hashtable class
this is a simple code:
import java.util.Hashtable ;
public class HashtableDemo{
public static void main(String[] args){
//This example creates a hashtable of numbers. It uses the names of the
numbers as keys:
Hashtable numbers = new Hashtable();
//public Object put(Object key,Object value);
numbers.put("one", new Integer(1));
numbers.put("two", new Integer(2));
numbers.put("three", new Integer(3));
//To retrieve a number, use the following code:
//public Object get(Object key);
Integer n = (Integer)numbers.get("two"); // (Integer) is casting
(ta7wil)
if (n != null) { //(n != null) : pour tester que cette valeur n'est pas
"null";
System.out.println("two = " + n);
}
}
}