Finding the longest string and its length using Java streams
You don't need the Pair.  You can get the String with the maximum length by doing

names.stream().max(Comparator.comparingInt(String::length))