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

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -