Subj : Re: Multi-dimensional data structure To : comp.programming From : August Karlstrom Date : Wed Oct 12 2005 02:00 pm adieyal@gmail.com wrote: > Can anyone point me in the right direction for a data structure that > represents a multi-dimensional hash. i.e. I want to be able to store > data under multiple keys but I don't want the order of the keys to be > significant. Essentially I want some sort of hypercube that I can slice > up by providing the appropriate keys. > > For instance > > DataStructure ds = new DataStructure(); > Object o1 = new Object(); > Object o2; > ds.put(new String[]{"Key1", "Key2", "Key3"}, o1); > o2 = ds.get(new String[]{"Key2", "Key3", "Key1"}); > assert(o1 == o2); > > I apologise if this question has been answered before but I haven't > found any satisfactory answers so far. Why not just sort the given keys, concatenate them (perhaps with some rarely used character as separator) and then compute the hash code from the concatenated string? Example: "Key2", "Key3", "Key1" -> "Key1¤Key2¤Key3" August .