store 4 values in a hashmap

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jamborta
    New Member
    • Jul 2008
    • 7

    store 4 values in a hashmap

    hi,

    how would you store 4 values, a key and 3 integers in a hash map, is it possible to use if somethin like HashMap<String, Object>()?
    if so how can i put an array like
    int[][][]
    into the Object slot?

    thanks a lot,
    Tom
  • jx2
    New Member
    • Feb 2007
    • 228

    #2
    i am not sure i fully understand what you mean
    but i think this may help you:
    Code:
     
            Map<Integer, int[]> map = new HashMap();
            int[]  a1 = {13,17,19};
            int[]  a2 = {23,29,31};
            
            map.put(1, a1 );
            map.put(2, a2 );
    or
    Code:
            Map<Integer, MyClass> map = new HashMap();
            MyClass  a1 = new MyClass(13,17,19);
            MyClass  a1 = new MyClass(23,29,31);
            
            map.put(1, a1 );
            map.put(2, a2 );
    i hope that helped
    if not post again

    Jan Jarczyk

    Comment

    Working...