List<InstalledPackage> () { final List<InstalledPackage> results = new ArrayList<>(); final int[] rows = myPackagesTable.getSelectedRows(); for (int row : rows) { final Object packageName = myPackagesTableModel.getValueAt(row, 0); if (packageName instanceof InstalledPackage) { results.add((InstalledPackage)packageName); } } return results; }