我正在尝试制作二维哈希集功能。我有一个循环遍历整数对:
ResultSet getAssociations;
Statement getAssociationsSelect = sqlConn
.createStatement();
getAssociations = getAssociationsSelect
.executeQuery("SELECT ProductId, ThemeId FROM ProductTheme");
while(getAssociations.next()) {
int productId1 = getAssociations.getInt(1);
int themeId1 = getAssociations.getInt(2);
}
当当前的整数对与前一对整数不匹配时,我想存储它们。我认为哈希集将是最好的方法,因为我可以插入对并且不会重复。我该怎么做呢?