java - How should I store a two column table with duplicated first column entries? -
in program there 72 paths (numbered 1 72). in program need retrieve adjacent paths, , check ownership of these 2 paths. paths range 2 adjacent paths 4. example path 1 has adjacent paths 2 , 7; whereas, path 13 has adjacent paths 8, 12, 14, 21. these path relationships constant.
i write method path.getadjacent(int pathnum)
return int[]
containing adjacent paths. way make loop checks each owners each adjacent path.
how should store , access path relationship data may efficiently retrieved method path.getadjacent()
?
davide answered question:
use map<integer,arraylist<integer>>
Comments
Post a Comment