Iterator<Collection<Node>> () { return new MyIterator<Collection<Node>>(componentSizes.size()) { private int offset; @Override protected Collection<Node> get(int i) { final int cSize = componentSizes.getInt(i); final int cOffset = offset; if (cSize == 0) { return Collections.emptyList(); } offset += cSize; return new MyCollection<Node>(cSize) { @Override public @NotNull Iterator<Node> iterator() { return new MyIterator<Node>(cSize) { @Override public Node get(int i) { return getNodeByTNumber(cOffset + i); } }; } }; } }; }