Arrays of different types
Posted
by Tyler
on Stack Overflow
See other posts from Stack Overflow
or by Tyler
Published on 2010-05-12T01:48:24Z
Indexed on
2010/05/12
1:54 UTC
Read the original article
Hit count: 266
java
Hi -
Is it possible to have an array that contains two different types of data? I want to have an array that contains a double and also a string. I attempted:
ArrayList<double><String> array;
But that didn't work.
Sorry for the silly question, but it has been a while since I have used something like this.. Can you refresh my memory on how would I declare and populate such an array?
And then to take it a step further, I would like to sort the array by the double if possible?
Thanks!
© Stack Overflow or respective owner