2024 - Tutorial untuk syntax highligher
asdasdsakhjdf sadjhf sadhkjf sdahf dsaj
Sadasdadsadsa
package mybasicjava.ardie;
public class BasicForeach {
public static void main(String []args) {
int arr[] = {1,2,3,4,6 };
for ( int e : arr){
System.out.print(e+ " ");
}
}
}
asdasdsa
asdsadsa
List<List<String>> listOfList = Arrays.asList(
Arrays.asList("Reflection", "Collection", "Stream"),
Arrays.asList("Structure", "State", "Flow", "Reflection"),
Arrays.asList("Sorting", "Mapping", "Reduction", "Sorting")
);
// Create a set to hold intermediate results
Set<String> intermediateResults = new HashSet<>();
List<String> result = listOfList.stream()
.flatMap(List::stream) // required converto to list
.map(String::toUpperCase)
//.distinct() // remove duplicate
.sorted()
.peek( s -> intermediateResults.add(s))
.collect(Collectors.toList());
System.out.println("Intermediate Result : ");
intermediateResults.forEach(System.out::println);
Tidak ada komentar