java - Index the ID number in an ArrayList -


so, have arraylist taken .txt file. displays following details:

id car manufacturer car type colour *blank line* 

for example:

21 vauxhall corsa red  19 vauxhall corsa blue  18 vauxhall corsa white 

i curious how make id "index" of arraylist, if car deleted or added arraylist, automatically adjust id number.

you'll need set id primary key arraylist. can creating arraylist contains hashmap objects

arraylist<hashmap<int, carobject>> = new arraylist()

sorting becomes question of iterating through integer ids in arraylist objects


Comments

Popular posts from this blog

ios - Memory not freeing up after popping viewcontroller using ARC -

Java JSoup error fetching URL -

webstorm - PhpStorm file cache conflict with TypeScript compiler -