问题 I have a List of String like: List<String> locations = Arrays.asList("US:5423","US:6321","CA:1326","AU:5631"); And I want to convert in Map<String, List<String>> as like: AU = [5631] CA = [1326] US = [5423, 6321] I have tried this code and it works but in this case, I have to create a new class GeoLocation.java . List<String> locations=Arrays.asList("US:5423", "US:6321", "CA:1326", "AU:5631"); Map<String, List<String>> locationMap = locations .stream() .map(s -> new GeoLocation(s.split(":")[0