void (Consumer<? super Set<T>> callback) { myBuilder.setItemChosenCallback(() -> { final Set<T> selection = new HashSet<>(); for (TreePath path : myTree.getSelectionModel().getSelectionPaths()) { Object component = path.getLastPathComponent(); if (component != null) { selection.add((T)component); } } if (!selection.isEmpty()) { callback.consume(selection); } }); }