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

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -