X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2Futil%2FIntPairMap.java;h=706e54b0fdda8d9b5d8282fcac929ed0d7958b58;hb=d334d5060dbaa23f8f94b60cf1238c3f47cb5e9f;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..706e54b 100644 --- a/src/edu/berkeley/sbp/util/IntPairMap.java +++ b/src/edu/berkeley/sbp/util/IntPairMap.java @@ -1,8 +1,11 @@ +// Copyright 2006 all rights reserved; see LICENSE file for BSD-style license + 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 +18,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(); } }