前些天發現了一個巨牛的人工智能學習網站,通俗易懂,風趣幽默,忍不住分享一下給大家。點擊跳轉到教程。
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