Saturday, November 16, 2013

Data Structures(Dictionary) in Java

Java Data Structures(Dictionary)
Map has its implementation in various classes like HashMap, Following is the example to explain map functionality:

import java.util.*;
public class CollectionsDemo {
public static void main(String[] args) {
Map m1 = new HashMap();
m1.put("Zara", "8");
m1.put("Mahnaz", "31");
m1.put("Ayan", "12");
m1.put("Daisy", "14");
System.out.println();
System.out.println(" Map Elements");
System.out.print("\t" + m1);
}
}

No comments:

Post a Comment