Given that we have a list of the Bank, each bank has several offices,
public class Bank {
private String name;
private List<String> branches;
public String getName(){
return name;
}
public List<String> getBranches(){
return branches;
}
}
For instance:
Bank "Mizuho": branches=["London", "New York"]
Bank "Goldman": branches = ["London", "Toronto"]
Given the list of banks, I will have a bank representative card for each city. In the above example, I need the result
Map["London"] == ["Mizuho", "Goldman"]
Map["New York"] == ["Mizuho"]
Map["Toronto"] == ["Goldman"]
How can I achieve this result using the Java 8 API? Using pre-Java8 is simple, but verbose. Thank.
source
share