X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2Futil%2FIntPairMap.java;h=a45c6c3d4501e4979ffb5a4c367e8971172ed4f8;hb=38eb7943a4be918d46cb6517004e57ca91410ce0;hp=c355488ec01826f06eacd1409ff2837f03767492;hpb=21b1b10a3ffb4b2021ad940f9cd722e3ed5300c4;p=sbp.git diff --git a/src/edu/berkeley/sbp/util/IntPairMap.java b/src/edu/berkeley/sbp/util/IntPairMap.java index c355488..a45c6c3 100644 --- a/src/edu/berkeley/sbp/util/IntPairMap.java +++ b/src/edu/berkeley/sbp/util/IntPairMap.java @@ -1,8 +1,9 @@ package edu.berkeley.sbp.util; import java.util.*; -/** a mapping from keys of type K to sets of values of type T */ -public final class IntPairMap { +// FEATURE: make this faster (plenty of ways: quadradic probing hash table is one) +/** a sparse mapping from pairs of int's to V's */ +public final class IntPairMap implements Iterable { private final HashMap hm = new HashMap(); @@ -15,4 +16,5 @@ public final class IntPairMap { public Iterable values() { return hm.values(); } public int size() { return hm.size(); } public void toArray(V[] v) { hm.values().toArray(v); } + public Iterator iterator() { return hm.values().iterator(); } }