I've been using the java 8 Streams for a while. I came across a situation where I need to stream through a List and pass each element to a static method along with another argument. Is it possible in java 8?
........
String designation = "Engineer";
List<String> names = new ArrayList<>();
names.add("ABC");
names.add("DEF");
names.add("GHI");
names.stream().map(MyClass::createReport);
..........
class MyClass {
public static void createReport(String name, String designation) {
System.out.println(name+"\t"+designation);
}
}
How can I pass the designation String via stream().map()?