ArrayList<DragImageRow> (@NotNull JTree tree, @Nullable TreePath @NotNull [] paths) { var count = 0; int maxItemsToShow = paths.length < 20 ? paths.length : 10; var dragImageRows = new ArrayList<DragImageRow>(); for (TreePath path : paths) { dragImageRows.add(new NodeRow(tree, path)); count++; if (count > maxItemsToShow) { dragImageRows.add(new MoreFilesRow(tree, paths.length - maxItemsToShow)); break; } } return dragImageRows; }