java - Array of arraylists -


im having trouble making array of arraylists, heres's code :
'arraylist<integer>[] solucao= new arraylist[6];' , using code below:

           solucao[0].add(1);             solucao[0].size();                 solucao[1].size();                 solucao[1].add(1);             solucao[2].size();             solucao[2].add(1);                 solucao[3].size();                 solucao[3].add(1);             solucao[4].size();             solucao[4].add(1);                 solucao[5].size();                 solucao[5].add(1);             solucao[6].size();             solucao[6].add(1);                 solucao[7].size();                 solucao[7].add(1); 

all calls size return null. knows how solve it?

im looking data structure of array of arraylists, each array[i] position return me arraylist of integers.

thank you

you have initialize each arraylist in array.

arraylist[] solucao = new arraylist[6]; (int = 0; < solucao.length; i++)     solucao[i] = new arraylist(); 

i thought couldn't have array of arraylist. apparently can, must non-generic. should reconsider why you're doing this...


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -