DevoxxUK Lambdas Lab
Paul Sandoz
paul.sandoz at oracle.com
Thu Apr 4 01:21:21 PDT 2013
On Apr 3, 2013, at 10:12 AM, Richard Warburton <richard.warburton at gmail.com> wrote:
> 3. Several people requested a way to transform a boxed stream into an
> unboxed stream. Its pretty easy to go the other way around, but there
> didn’t seem to be any utility methods for making the boxed -> unboxed
> transformation.
>
Stream<Integer> s = Arrays.asList(1, 2, 3, 4).stream();
IntStream is = s.mapToInt(Integer::intValue);
Things have been moving fast so i don't know if the lambda build you used had the overloaded map methods or map/mapToInt etc.
Note that the IntStream.boxed is implemented as:
public final Stream<Integer> boxed() {
return mapToObj(Integer::valueOf);
}
Perhaps we should document how boxed is implemented and how one can convert back?
Paul.
More information about the lambda-dev
mailing list