Skip to content

Instantly share code, notes, and snippets.

@kroovysteph
Created January 24, 2017 16:10
Show Gist options
  • Save kroovysteph/ba7fc1cb5a8f52965a3dadb62b74c7de to your computer and use it in GitHub Desktop.
Save kroovysteph/ba7fc1cb5a8f52965a3dadb62b74c7de to your computer and use it in GitHub Desktop.
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) {
try {
sum += Integer.parseInt(kv.value);
} catch (Exception e) {
System.out.println(e);
}
}
}
return sum;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment