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