java - creating two dimensional hashset functionality -


i trying make 2 dimensional hashset functionality. have loop iterates through pairs of integers:

        resultset getassociations;         statement getassociationsselect = sqlconn                 .createstatement();         getassociations = getassociationsselect                 .executequery("select productid, themeid producttheme");         while(getassociations.next()) {             int productid1 = getassociations.getint(1);             int themeid1 = getassociations.getint(2);         } 

when current pair of integers not match previous pair of integers want store them. figured hashset best approach because can insert pairs , wont take repeats. how do this?

if want simple solution concatenate both keys , store resulting string, e.g.

string newkey = string.format( "%d-%d.", productid1 , themeid1 ); 

it allways generate unique key each combination.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -