java.util.IdentityHashMap.entrySet()方法例項
阿新 • • 發佈:2019-02-02
entrySet() 方法是用來獲取此對映中包含的對映關係的set檢視。
宣告
以下是java.util.IdentityHashMap.entrySet()方法的宣告。
publicSet<Map.Entry<K,V>> entrySet()
方法呼叫返回此對映中包含的身份對映關係的set檢視。
下面的例子顯示java.util.IdentityHashMap.entrySet()方法的使用例子
package com.yiibai;import java.util.*;publicclassIdentityHashMapDemo{publicstaticvoid main(String args[]){// create identity hash mapIdentityHashMap ihmap =newIdentityHashMap();// populate the map ihmap.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]參見:http://www.yiibai.com/java/util/identityhashmap_entryset.html