// In IntelliJ IDEA Ultimate 14.1.4, with Java8, // the editor incorrectly highlights various parts of this code as uncompilable, when it is actually fine. public void testIt() { Map innerMap = new HashMap<>(); innerMap.put(2, "abc"); Map> outerMap = new HashMap<>(); outerMap.put(1L, innerMap); Map> transformedMap = outerMap.entrySet().stream() .collect(toMap( Map.Entry::getKey, m -> m.getValue().entrySet().stream() .collect(toMap( Map.Entry::getKey, v -> v.getValue().toUpperCase())))); }