java - How to perform Lambda expressions and forEach on normal arrays? -
i print arraylists such as
colors.foreach(color -> system.out.printf("color: %s ", color));
but somehow can't apply normal arrays (string[] colors
).
how apply expression normal arrays?
basically need way perform stream operations on arrays. it's simple converting array stream:
arrrays.stream(colors).foreach(color -> system.out.printf("color: %s ", color));
for more info on see java 8 stream , operation on arrays
Comments
Post a Comment