On Wed, 2 Apr 2025 09:34:57 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> Per Minborg has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - Add lazy toSting for StableMap::values >> - Make toString for reversed and sublist lazy > > src/java.base/share/classes/java/lang/StableValue.java line 657: > >> 655: * @param <V> the type of mapped values in the returned map >> 656: */ >> 657: static <K, V> Map<K, V> map(Set<K> keys, > > Like `List`, a map can also generate other kinds of collections: > 1. an entry set (`Map::entrySet`) > 2. a key set (`Map::keySet`) > 3. a value set (`Map::values`) > > We should make it clear that calling (1) and (3) will result in materializing > the values for the map -- we do not have "lazy" views for such sets. These constructs are also lazy actually which is cool. Operating on them will only materialize values on demand. We should document that. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2024806772