https://www.runoob.com/java/java-map-interface.html
实例
下面的例子来解释Map的功能
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(" " + m1);
}
}
以上实例编译运行结果如下:
Map Elements
{Mahnaz=31, Ayan=12, Daisy=14, Zara=8}