if (depth == 0) {
throw new AssertionError("Memoized values with empty stack");
}
for (MyKey key : map.keySet()) {
final SoftReference reference = map.get(key);
if (reference != null) {
final Object result = reference.get();
if (result != null) {
return result;
}
}
}