I\'m trying to perform a map operation on each entry in a Map object.
I need to take a prefix off the key and convert the value from one type to another
Question might be a little dated, but you could simply use AbstractMap.SimpleEntry<> as follows:
private Map mapConfig(
Map input, String prefix) {
int subLength = prefix.length();
return input.entrySet()
.stream()
.map(e -> new AbstractMap.SimpleEntry<>(
e.getKey().substring(subLength),
AttributeType.GetByName(e.getValue()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
any other Pair-like value object would work too (ie. ApacheCommons Pair tuple).