CodesJava

Easy learning with example program codes

java 8 stream map example


The java.util.stream is a sequence of elements supporting sequential and parallel aggregate operations.

java 8 stream map example

package com.codesjava;
 
import java.util.Arrays;
import java.util.List;
 
public class Test{  
    public static void main(String[] args) {  
    	List<String> names = Arrays.asList("Jai", "Mahesh", "Vishal", "Hemant", "Naren");
        names.stream().map(String::toUpperCase).forEach(System.out::println);
    }  
}

Output

JAI
MAHESH
VISHAL
HEMANT
NAREN
Sign Up/ Sign In
Ask a Question


Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki