java.util.IdentityHashMap.entrySet()方法实例

来源:互联网 发布:日工作计划软件 编辑:程序博客网 时间:2024/05/17 16:45


entrySet() 方法是用来获取此映射中包含的映射关系的set视图。

声明

以下是java.util.IdentityHashMap.entrySet()方法的声明。

public 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 map      IdentityHashMap ihmap = new IdentityHashMap();            // populate the map      ihmap.put(1, "java");      ihmap.put(2, "util");      ihmap.put(3, "package");            // create entry set from the map      Set 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
0 0
原创粉丝点击