java - How to initiate multidimensional arraylist with different objects? -


i'm having trouble trying initiate arraylist in first column want string, , second column custom object.

for example column [0] string, , column[1] integer. convention attempts of creating multidimensional arraylist in used int[][] or string[][] don't seem work :( welcome help. @ point don't think it's java allows. can make work 1 type of object it's not want. thanks!

sure does, weaken/eliminate type-checking:

map mymap<string>, integer> mydata = new hashmap<string, integer>(); 

now list of strings can retrieved mymap.keyset() , values can retrieved mymap.values(). each of these return set, can convert list using following code:

list<string> strings = new arraylist<string>(mymap.keyset()); // strings list<integer> numbers = new arraylist<integer>(mymap.values(); // numbers 

good luck , if should run problems, leave comment.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -