HashMap Example 1 : Collection « Apache Common « Java






HashMap Example 1

import org.apache.commons.collections.BidiMap;
import org.apache.commons.collections.bidimap.DualHashBidiMap;

public class HashMapExampleV1 {
  public static void main(String args[]) {
    BidiMap agentToCode = new DualHashBidiMap();
    agentToCode.put("007", "Bond");
    agentToCode.put("006", "Trevelyan");
    agentToCode.put("002", "Fairbanks");

    System.err.println("Agent name from code: " + agentToCode.get("007"));
    System.err.println("Code from Agent name: " + agentToCode.getKey("Bond"));
  }
}
           
       








ApacheCollectionHashMapExampleV1.zip( 514 k)

Related examples in the same category

1.Collection Bag
2.Transformer Example
3.Collection BidiMap
4.Collection Buffer
5.Collection Closure
6.Comparator Example For BuildIn Data Type
7.Comparator Example For User Defined Class
8.Cookie Bag 2
9.Factory Example 1
10.List Example 1
11.MapHeaven 1
12.Multi Key Example 1
13.MultiKey Example 2
14.Set Example 1
15.Set Example 2
16.Bean Comparator ( Sorting based on Properties of class )Bean Comparator ( Sorting based on Properties of class )