Iterable<VirtualFile> (int @NotNull [] fileIds) { if (fileIds.length == 0) return Collections.emptyList(); return () -> new Iterator<>() { int myId; VirtualFile myNext; @Override public boolean hasNext() { while (myNext == null && myId < fileIds.length) { myNext = VirtualFileManager.getInstance().findFileById(fileIds[myId++]); } return myNext != null; } @Override public VirtualFile next() { if (!hasNext()) throw new NoSuchElementException(); VirtualFile next = myNext; myNext = null; return next; } }; }