2
What I intend to do is make a data association as follows:
(<<Integer>, <Integer>, ArrayList<Integer>)
I tried to create a HashMap<Integer,HashMap<Integer,ArrayList<Integer>>>
the problem is I forgot the keys have to be unique and I need to have equal values sometimes.
Ex: (1,1,{1,2,3,4}) (1,2,{1,3})
How best to aggregate this data?
and if you create a class with these values does not give?
– jsantos1991
I have not experienced or know how well I do. A class that holds these values? Values are not static.
– Hugo Machado
The fact that the values are not static is unimportant, because you would update the class through the get and set, but you would have the same key problem (now thinking), because how would you distill the class x from the class y, if the values you compare are equal? Are you sure you can’t get a single key?
– jsantos1991
it is possible for the two keys to be the same in other example:
(<<1>, <1>, ArrayList<Integer>)
,(<<1>, <2>, ArrayList<Integer>)
,(<<1>, <1>, ArrayList<Integer>)
: type in this case example 1 is equal to 3 ?– jsantos1991
It’s the same but the 3 examples have to be inserted in the BD. Using Hashmap he wouldn’t duplicate my data and I need to be able to duplicate them
– Hugo Machado
because with the
HasMap
It replaces the older one with the new one when they’re the same, so it doesn’t... That data will be changed that is, after being in the collection needs updated?– jsantos1991
No, once they’re in the collection, they’re sent straight to the comic book and you don’t care about those figures anymore. Simply afterwards I can make another collection and send other data, but being in the collection, they are only sent to the comic
– Hugo Machado
What I would do, @Hugo, is create a separate class to support the data you need, and together with this data implement a variable
id
, because then in the hr of persisting, with the proper manipulation, you could insert identical objects more than once.– Gustavo Cinque