Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Looking for an appropriate data structure

 
Edward Nelson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need a data structure that can store multiple (ordered) units of data, each of them in the following format:

Value1 is mapped to Value2 which is mapped to Value3 which is mapped to Value4

More specifically,
Value1 can be "a" or "b"
Value2 can be "g" or "u"
Value3 can any string
Value4 can be a string containing one character from 'x', 'y', or 'z', or any combination of these (such as "xy", "xz", etc)


A data structure defined as an ArrayList of Map<String, Map><String, Map><String, String>> should work, but I'm looking for better ideas from you guys.

Any suggestions?
 
Campbell Ritchie
Sheriff
Pie
Posts: 48972
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have described a class with 4 fields. You will have to do some sort of validation in its constructor. It will probably have to implement the Comparable interface.
 
Edward Nelson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Campbell, that certainly sounds better.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48972
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic