提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
从哈希映射中移除值
/** N o w J a v a . c o m 提供 **/ import java.util.HashMap; public class Main { public static void main(String[] args) { HashMap hMap = new HashMap(); //add key value pairs to HashMap hMap.put("1","One"); hMap.put("2","Two"); hMap.put("3","Three"); Object obj = hMap.remove("2"); System.out.println(obj + " Removed from HashMap"); } }