public static <ROW_OBJECT> void setSelectedItems(JTable table, List<ROW_OBJECT> items) {

		if (CollectionUtils.isEmpty(items)) {
			table.clearSelection();
			return;
		}

		TableModel model = table.getModel();
		if (!(model instanceof RowObjectTableModel gModel)) {
			return;
		}

		ListSelectionModel selectionModel = table.getSelectionModel();
		int mode = selectionModel.getSelectionMode();
		if (mode == ListSelectionModel.SINGLE_SELECTION) {
			// take the last item to mimic what the selection model does internally
			ROW_OBJECT item = items.get(items.size() - 1);
			@SuppressWarnings({ "unchecked" })
			int viewRow = gModel.getRowIndex(item);
			table.setRowSelectionInterval(viewRow, viewRow);
			return;
		}

		//
		// For ListSelectionModel SINGLE_INTERVAL_SELECTION and MULTIPLE_INTERVAL_SELECTION, the
		// model will update any selection given to it to match the current mode.
		//
		List<Integer> rows = new ArrayList<>();
		for (ROW_OBJECT item : items) {
			@SuppressWarnings({ "unchecked" })
			int viewRow = gModel.getRowIndex(item);
			if (viewRow >= 0) {
				rows.add(viewRow);
			}
		}
		if (rows.isEmpty()) {
			return; // items may be filtered out of view
		}

		selectionModel.setValueIsAdjusting(true);
		selectionModel.clearSelection();
		for (int row : rows) {
			selectionModel.addSelectionInterval(row, row);
		}
		selectionModel.setValueIsAdjusting(false);
	}
Select the given row objects.  No selection will be made if the objects are filtered out of
view.  Passing a {@code null} list or an empty list will clear the selection.

@param table the table in which to select the items
@param items the row objects to select
Ghidra/Framework/Docking/src/main/java/docking/widgets/table/TableUtils.java