如何通过Value从hashmap中删除条目? [英] how to remove entry from hashmap by Value?

查看:76
本文介绍了如何通过Value从hashmap中删除条目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一种方法,通过它的值从hashmap中删除一个入口集。有没有一个简单的方法没有迭代?

I need a method to remove a entryset from hashmap by it's value. Is there a simple method without iteration?

推荐答案

有一个简单的方法,但它会在内部使用迭代。 (这是没有办法的。)

There's a simple method, but it'll use iteration internally. (There's no way around that.)

map.values().remove(valueToRemove);

这篇关于如何通过Value从hashmap中删除条目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆