This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Looking for an appropriate data structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Looking for an appropriate data structure" Watch "Looking for an appropriate data structure" New topic
Author

Looking for an appropriate data structure

Edward Nelson
Greenhorn

Joined: Apr 29, 2008
Posts: 8
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

Joined: Oct 13, 2005
Posts: 38045
    
  22
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

Joined: Apr 29, 2008
Posts: 8
Thanks Campbell, that certainly sounds better.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38045
    
  22
You're welcome
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Looking for an appropriate data structure
 
Similar Threads
c:out
How to convert query string into xml Structure
What is a data structure for Map that preserves insert order?
String.split() question
problem with struts2 drop down