Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-9405

Use Map API computeIfAbsent Where Applicable

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.5.0
    • clients
    • None

    Description

      to implement a multi-value map, Map<K,Collection<V>>, supporting multiple values per key:

      map.computeIfAbsent(key, k -> new HashSet<V>()).add(v);

      https://docs.oracle.com/javase/8/docs/api/java/util/Map.html#computeIfAbsent-K-java.util.function.Function-

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              belugabehr David Mollitor
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: