Imagine the following scenario: A list of Object[]
. Something similar to this:
List<Object[]> lista = new ArrayList<>();
Object[] dados = new Object[3];
dados[0] = 1;
dados[1] = 20;
dados[1] = "cristiano";
lista.add(dados);
dados = new Object[3];
dados[0] = 2;
dados[1] = 40;
dados[1] = "fulano";
lista.add(dados);
How would I do to return a list of integers, containing only the values of the first position of the array, using Stream
of java 8?
The expected result would be as follows:
1
2