Mercurial > hg > graal-compiler
changeset 19015:ea1351d22e55
Added entrySet and keySet to NodeNodeMap
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Wed, 28 Jan 2015 12:39:10 -0800 |
parents | 4f3c6cc1794a |
children | a02ffe9e18dd |
files | graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeNodeMap.java |
diffstat | 1 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeNodeMap.java Wed Jan 28 12:09:13 2015 -0800 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeNodeMap.java Wed Jan 28 12:39:10 2015 -0800 @@ -55,7 +55,11 @@ } public Set<Node> keySet() { - throw new UnsupportedOperationException("Cannot get key set from this map"); + HashSet<Node> entries = new HashSet<>(); + for (Map.Entry<Node, Node> entry : entries()) { + entries.add(entry.getKey()); + } + return entries; } public Collection<Node> values() { @@ -69,7 +73,11 @@ return result; } - public Set<java.util.Map.Entry<Node, Node>> entrySet() { - throw new UnsupportedOperationException("Cannot get entry set for this map"); + public Set<Map.Entry<Node, Node>> entrySet() { + HashSet<Map.Entry<Node, Node>> entries = new HashSet<>(); + for (Map.Entry<Node, Node> entry : entries()) { + entries.add(entry); + } + return entries; } }