Read object from file in java -


i have class has method generate id incrementally created objects , add vector ,then save .dat file read file , add objects vector but, when open program again create objects, starts initial id, doesn't continue last id. solution this?

you using counter-like id generator , starting id being initialized during startup. 2 ways:

  1. store last index used in file load first retrieve , continue sequence
  2. using such ids not considered good, if want uuid (universally unique ids) java provides class such java.util.uuid.

Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -