集册 Java实例教程 从树映射中移除值

从树映射中移除值

欢马劈雪     最近更新时间:2020-01-02 10:19:05

489
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
从树映射中移除值


import java.util.TreeMap;/*来 自 nowjava.com*/

 

public class Main {

 

  public static void main(String[] args) {

    TreeMap treeMap = new TreeMap();

    treeMap.put("1","One");

    treeMap.put("2","Two");

    treeMap.put("3","Three");

 

    Object obj = treeMap.remove("2");

    System.out.println(obj + " Removed from TreeMap");
    /* from 
    N o w J a v a . c o m*/

  }

}