0
I’m using List
to sort some values, but I need to separate them after I manipulated the values.
List<Map.Entry<String,Integer>> lista = new ArrayList<Map.Entry<String,Integer>>(fila);
And to print I’m using:System.out.println(lista);
And so it returns to me all the elements of the list. [c=30, e=25, b=20]
.
My intention would be to pass this to an array, for example, because my list is small (as in case 3). 'Cause if you go to a vector, I can only access the position I want.
You can only access the position you want using Arraylist as well, try this:
lista.get(0);
, it will return you only the first element of the list. This is no longer enough for you?– Math
I completely forgot about . get(). I will use it to use the pass to vector, I need to work with vector in this part. Thank you @Math
– Pacíficão
To transform from Arraylist to Vector you can do so:
Integer vetor[] = lista.toArray(new Integer[lista.size()]);
– Math
@Math I will use this way that you yourself said... thanks again! As always you saving me... I owe you beers, in case you drink :D
– Pacíficão