PersistentList<T> (@NotNull Predicate<? super KeyedLazyInstance<T>> isMyBean, @NotNull List<? extends KeyedLazyInstance<T>> extensions) { PersistentList<T> result = persistentListOf(); for (KeyedLazyInstance<T> bean : extensions) { if (!isMyBean.test(bean)) { continue; } T instance = instantiate(bean); if (instance == null) { continue; } result = result.add(instance); } return result; }