Although this doesn't answer the question, a possible solution to your problem would be:
try{
int i = map.values().stream().mapToInt(e -> e).max().getAsInt();
}catch(NoSuchElementException e)
e.printStackTrace();
}
The mapToInt(e -> e) method uses a lambda expression to transform every element in the stream to a integer value and returns a IntStream where max() method can then be called.
Note that max() returns an OptionalInteger and so a getAsInt() or a orElse(0) method call is nedeed.
You can take a look at the docs for a more in-depth answer: IntStream, OptionalInt