Double Join Key Map, possible?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    Double Join Key Map, possible?

    I'm in need of a map with two "joint" or "combined" integer keys pointing to a value (an object).

    map[K1,K2] = myObject


    What I have to do now is combine the two in a string separated by a comma: "105-12"

    Combined they are unique. There will only be one 105,12 key combo.

    possible? Should I just string them with a dash?


    Thanks,


    Dan
  • Dheeraj Joshi
    Recognized Expert Top Contributor
    • Jul 2009
    • 1129

    #2
    As far as you have key and value pair you can do it.

    It do not matter whether key is a String or an integer. You can combine two integers to a string and use it as key.

    Regards
    Dheeraj Joshi

    Comment

    • dlite922
      Recognized Expert Top Contributor
      • Dec 2007
      • 1586

      #3
      Sorry, if I wasn't clear.

      My question was that if it was at all possible withOUT converting it to a string.

      I.e. Is it possible for a value to have 2 keys without having each key separately pointing to their own value.

      Pseudo code:

      Is something like this possible:
      Map[536,99] = myObject;

      I already I know I can do both of these:
      map['539-99'] = myObject;

      or

      map[539] = myObject;
      map[99] = myObject;

      Hope I made myself more clear.

      Thanks,

      Dan

      Comment

      • Dheeraj Joshi
        Recognized Expert Top Contributor
        • Jul 2009
        • 1129

        #4
        Are you looking for this?

        Regards
        Dheeraj Joshi

        Comment

        Working...