Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8072721

add Map.transform that transforms a map to another map (with different types) in a single step

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P5 P5
    • None
    • None
    • core-libs

      Consider something like

          <K1,V1> Map<K1,V1> transform(Function<K,K1> keyFunc, Function<V,V1> valueFunc)

      This creates a new Map and populates it with the result of calling keyFunc, valueFunc on all entries
      of the current map. This differs from Map.replaceAll() which modifies the map in-place and which is
      constrained to keep the same key and value types.

      Probably need overloads with a Map supplier and with a merging function, in case values end up being mapped
      to the same key in the destination.

            Unassigned Unassigned
            smarks Stuart Marks
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: