Java Code putting values in hashMap -
a hashmap stores data.
private final map<videoobj,record> _data = new hashmap<videoobj,record>(); what difference between
record rin= new record(video, numowned+change, numout, numrentals); _data.put(video, rin); and
record r= _data.get(video); r.numowned+=change; in cases can create problems values.
video should override equals , hashcode methods , preferably video class should made final.
java hashmap
No comments:
Post a Comment