Вы можете сделать это неявно.
// Create the map. There is no restriction to the size that the array String can have
HashMap<Integer, String[]> map = new HashMap<Integer, String[]>();
//initialize a key chosing the array of String you want for your values
map.put(1, new String[] { "name1", "name2" });
//edit value of a key
map.get(1)[0] = "othername";
Это очень просто и эффективно. Если вам нужны значения разных классов, вы можете сделать следующее:
HashMap<Integer, Object[]> map = new HashMap<Integer, Object[]>();
Поскольку вы установили, что выбор производится по строкам, тогда нужно только получить строку и выполнить итерацию по ней, в этом случае используя set, получить выбранные строки и метки в столбцах.
def on_pbOk_clicked(self):
message: str = ""
rows = set(ix.row() for ix in self.dataView.selectedIndexes())
for row in rows:
values_for_row = []
for col in range(App.MAIL_RANGE):
it = self.dataView.model().item(row, col)
values_for_row.append(it.text())
text = " ".join(values_for_row)
self.create_dialog(text)
message += "\n" + text
print(message)