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

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

Command prompt result in label. Python 2.7 -