Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我打印这个哈希图时,我有一个哈希图,输出是这样的
{KEY_CH_UP=KEY_CH_UP, KEY_PANEL_CH_UP=KEY_PANEL_CH_UP, KEY_7=KEY_7, KEY_6=KEY_6, KEY_5=null}
现在我想得到所有的钥匙
values == null ;
遍历下面的类似内容并检查该值是否为 null :
Map<String, String> map = new HashMap<String, String>(); for(Map.Entry<String, String> en: map.entrySet()){ if(en.getValue()==null){ System.out.println(en.getKey()); } }