前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到教程。
entrySet() 方法是用来获取此映射中包含的映射关系的set视图。
声明
以下是java.util.IdentityHashMap.entrySet()方法的声明。
public Set<Map.Entry<K,V>> entrySet()
Set<Map.Entry<K,V>> entrySet()
方法调用返回此映射中包含的身份映射关系的set视图。
下面的例子显示java.util.IdentityHashMap.entrySet()方法的使用例子
package com.yiibai;import java.util.*;public class IdentityHashMapDemo {public static void main(String args[]) {// create identity hash mapIdentityHashMap ihmap = new IdentityHashMap();// populate the mapihmap.put(1, "java");ihmap.put(2, "util");ihmap.put(3, "package");// create entry set from the mapSet enset=ihmap.entrySet();System.out.println("Set view of the map: " + enset);}
}
com.yiibai;import java.util.*;public class IdentityHashMapDemo {public static void main(String args[]) {// create identity hash mapIdentityHashMap ihmap = new IdentityHashMap();// populate the mapihmap.put(1, "java");ihmap.put(2, "util");ihmap.put(3, "package");// create entry set from the mapSet enset=ihmap.entrySet();System.out.println("Set view of the map: " + enset);}
}
现在编译和运行上面的代码示例,将产生以下结果。
Set view of the map: [1=java, 3=package, 2=util]
view of the map: [1=java, 3=package, 2=util]
参见:http://www.yiibai.com/java/util/identityhashmap_entryset.html