Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
collectors and stream
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; import java.util.stream.*; class Rextester { public static void main(String args[]) { int a=0; List<String> number = Arrays.asList("Hello","Chalo","Bolo","galo","Hello"); System.out.println(number.stream().map(x -> x+"a").collect(Collectors.toList())); System.out.println( number.stream().map( num->num+" Yes" ).collect( Collectors.toList() ) ); System.out.println( number.stream().sorted().collect(Collectors.toList()) ); System.out.println( number.stream().filter( num->{ if(num.startsWith("H")) System.out.print(a); else System.out.print("0"); return num.startsWith("H");}).collect(Collectors.toList() )); System.out.println( number.stream().map(i->i+i).collect(Collectors.toList())); } }
run
|
edit
|
history
|
help
0
exp 1
Implement Queue with Limited Size of Arrays
DevStuff
Sieve of Eratosthenes Revisited
binary search
WM Test
Find Median in Large File of Integers
Stack implementation
jb11.0 threads tick tock
JAVA # 20 RASTGELE SAYIDAN EN KÜÇÜĞÜNÜ BULMAK