Skip to content

Instantly share code, notes, and snippets.

public int sumAllValues() {
// TODO: implement
int sum = 0;
for (int h=0; h < N; h++) {
for (KeyValue kv = buckets[h]; kv != null; kv = kv.next) {
if (kv.value.matches("^\\-?\\d*\\.?\\d*$")) {
sum += Integer.parseInt(kv.value);
}
}
}