Methods Summary |
---|
public boolean | containsKey(int key)
return ( (null!=get(key) ? true: false));
|
public java.lang.Object | get(int key)
int index = Math.abs(key % maxBuckets);
return buckets[index].get(key);
|
public com.sun.enterprise.util.collection.IntHashMap$IntHashMapIterator | iterator()
return new IntHashMapIterator();
|
public static void | main(java.lang.String[] args)
int count = 20;
long time=0, t1=0, t2 = 0;
String data = "SomeData_";
IntHashMap map = new IntHashMap();
for (int i=0; i<count; i+= 5) {
map.put(i, data + i);
}
for (int i=1; i<count; i+= 3) {
map.put(i, data + i);
}
for (int i=3; i<count; i+= 4) {
map.put(i, data + i);
}
for (int i=-23; i<count; i+= 4) {
map.put(i, data + i);
}
for (int j=-25; j<25; j++) {
System.out.println("Key: " + j + "; val: " + map.get(j));
}
t2 = System.currentTimeMillis();
Iterator iter = map.iterator();
while (iter.hasNext()) {
System.out.println("Got: " + iter.next());
}
|
public void | print()
for (int i=0; i<maxBuckets; i++) {
System.out.println("Bucket[" + i + "]: " + buckets[i]);
}
|
public void | put(int key, java.lang.Object object)
int index = Math.abs(key % maxBuckets);
buckets[index].put(key, object);
|
public java.lang.Object | remove(int key)
int index = Math.abs(key % maxBuckets);
return buckets[index].remove(key);
|