parent
faf3c7831f
commit
6dbd684279
|
|
@ -52,12 +52,7 @@ public class CollectionUtils {
|
|||
}
|
||||
|
||||
public static Collection filter(Collection c, Predicate p) {
|
||||
Iterator it = c.iterator();
|
||||
while (it.hasNext()) {
|
||||
if (!p.evaluate(it.next())) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
c.removeIf(o -> !p.evaluate(o));
|
||||
return c;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,10 +22,7 @@ public class CustomizerRegistry {
|
|||
Class<? extends KeyFactoryCustomizer> klass = customizer.getClass();
|
||||
for (Class type : customizerTypes) {
|
||||
if (type.isAssignableFrom(klass)) {
|
||||
List<KeyFactoryCustomizer> list = customizers.get(type);
|
||||
if (list == null) {
|
||||
customizers.put(type, list = new ArrayList<>());
|
||||
}
|
||||
List<KeyFactoryCustomizer> list = customizers.computeIfAbsent(type, k -> new ArrayList<>());
|
||||
list.add(customizer);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue