Convert old "into" code to the collectors
Marcos Antonio
marcos_antonio_ps at hotmail.com
Wed Jan 16 06:34:51 PST 2013
Hello, everybody!
Before build b73 I had code like this:
List<PropriedadeChavePai> propriedades = new ArrayList<>();
chave.getPropriedadesChavePai().stream().
map(PropriedadeChavePai::new).
into(propriedades);
Now I'm having trouble trying to convert it to use the new Collectors. I have tried something like this:
chave.getPropriedadesChavePai().stream().
map(PropriedadeChavePai::new).
collect(Collectors.toCollection(propriedades));
but it didn't work and I couldn't figure out the right thing to do.
Thank you in advance.
Marcos
More information about the lambda-dev
mailing list