diff --git a/jps/model-impl/src/org/jetbrains/jps/model/impl/JpsElementCollectionImpl.java b/jps/model-impl/src/org/jetbrains/jps/model/impl/JpsElementCollectionImpl.java index b92f3108a0ba..3d33d4f152e1 100644 --- a/jps/model-impl/src/org/jetbrains/jps/model/impl/JpsElementCollectionImpl.java +++ b/jps/model-impl/src/org/jetbrains/jps/model/impl/JpsElementCollectionImpl.java @@ -41,17 +41,7 @@ public class JpsElementCollectionImpl extends JpsElementBa } public Iterable getElementsOfType(@NotNull final JpsElementType

type) { - return new Iterable() { - @Override - public Iterator iterator() { - return new FilteringIterator(myElements.iterator(), new Condition() { - @Override - public boolean value(E e) { - return e instanceof JpsTypedElement && ((JpsTypedElement)e).getType().equals(type); - } - }); - } - }; + return new JpsElementIterable(type); } @NotNull @@ -120,4 +110,22 @@ public class JpsElementCollectionImpl extends JpsElementBa addChild(e); } } + + private class JpsElementIterable implements Iterable { + private final JpsElementType myType; + + public JpsElementIterable(JpsElementType type) { + myType = type; + } + + @Override + public Iterator iterator() { + return new FilteringIterator(myElements.iterator(), new Condition() { + @Override + public boolean value(E e) { + return e instanceof JpsTypedElement && ((JpsTypedElement)e).getType().equals(myType); + } + }); + } + } }