I am trying to get Map<String,List<String>> from List<String> using split(), but I'm getting ArrayIndexOutOfBoundException.
List<String> lst = new ArrayList<>();
lst.add(A1);
lst.add(A2);
lst.add(A3);
Map<String, List<String>> test1 = lst.stream()
.map(s -> new AbstractMap.SimpleEntry<String,String>(s.split("[^A-Z]")[0], s.split("[^A-Z]")[1]))
.collect(Collectors.groupingBy(Map.Entry::getKey,
Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
results exception.