• Post Reply Bookmark Topic Watch Topic
  • New Topic

Which Collection Data Structure to be used  RSS feed

 
Dishi Jain
Ranch Hand
Posts: 46
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to maintain a list of old values and respective new value. Which Data structure I should use? ArrayList of array with 2 columns (old, new)
or anything better?
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.util.Map - one as key and other as value.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to maintain a list of old values and respective new value. Which Data structure I should use? ArrayList of array with 2 columns (old, new)
or anything better?


Seems a bit brittle to me. What about a List<Stack> or List<Deque>?

Alternatively, you might consider writing a Version<T> class of your own that maintains as many versions of type T as you want, and then putting those in a HashSet.

Winston

PS: What happened to the "quote"s? Doesn't seem to work here.
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I fixed the quotes - BB Code was disabled in your message (probably disabled in the one you were replying to, if you didn't set it that way yourself).
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matthew Brown wrote:I fixed the quotes - BB Code was disabled in your message (probably disabled in the one you were replying to, if you didn't set it that way yourself).

Ah, OK. Thanks.

Winston
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!