424,294 Members | 1,891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,294 IT Pros & Developers. It's quick & easy.

store 4 values in a hashmap

P: 7
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
Aug 2 '08 #1
Share this Question
Share on Google+
1 Reply


100+
P: 228
jx2
i am not sure i fully understand what you mean
but i think this may help you:
Expand|Select|Wrap|Line Numbers
  1.  
  2.         Map<Integer, int[]> map = new HashMap();
  3.         int[]  a1 = {13,17,19};
  4.         int[]  a2 = {23,29,31};
  5.  
  6.         map.put(1, a1 );
  7.         map.put(2, a2 );
  8.  
or
Expand|Select|Wrap|Line Numbers
  1.         Map<Integer, MyClass> map = new HashMap();
  2.         MyClass  a1 = new MyClass(13,17,19);
  3.         MyClass  a1 = new MyClass(23,29,31);
  4.  
  5.         map.put(1, a1 );
  6.         map.put(2, a2 );
  7.  
i hope that helped
if not post again

Jan Jarczyk
Aug 2 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.