Skip to content

Commit

Permalink
revise coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
gengliangwang committed Feb 27, 2020
1 parent d50c801 commit 9cb44c3
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -19,6 +19,7 @@

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -208,6 +209,7 @@ public void accept(Comparable<Object> key, T value) {
private final ConcurrentMap<Comparable<Object>, T> data;
private final String naturalParentIndexName;
// A mapping from parent to the natural keys of its children.
// For example, a mapping from a stage ID to all the task IDs in the stage.
private final ConcurrentMap<Comparable<Object>, NaturalKeys> parentToChildrenMap;

private InstanceList(Class<?> klass) {
Expand All @@ -229,8 +231,8 @@ int countingRemoveAllByIndexValues(String index, Collection<?> indexValues) {
Comparable<Object> parentKey = asKey(indexValue);
NaturalKeys children =
parentToChildrenMap.computeIfAbsent(parentKey, k -> new NaturalKeys());
for (Object key : children.keySet()) {
data.remove(asKey(key));
for (Comparable<Object> naturalKey : children.keySet()) {
data.remove(naturalKey);
count ++;
}
parentToChildrenMap.remove(parentKey);
Expand Down Expand Up @@ -328,7 +330,7 @@ private static class InMemoryView<T> extends KVStoreView<T> {
@Override
public Iterator<T> iterator() {
if (data.isEmpty()) {
return new InMemoryIterator<>(data.values().iterator());
return new InMemoryIterator<>(Collections.emptyIterator());
}

KVTypeInfo.Accessor getter = index != null ? ti.getAccessor(index) : null;
Expand Down

0 comments on commit 9cb44c3

Please sign in to comment.