Create Collector which merges results of two other collectors

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 12
    • Affects Version/s: None
    • Component/s: core-libs
    • None

      Add a new Collector into Collectors class which merges results of two other collectors. One API method should be added (name is subject to discussion):

      public static <T, R1, R2, R>
          Collector<T, ?, R> teeing(Collector<? super T, ?, R1> c1,
                                     Collector<? super T, ?, R2> c2,
                                     BiFunction<? super R1, ? super R2, ? extends R> finisher);

      Every stream element should be passed to both collectors c1 and c2. To compute a final result, a finisher function is called which combines the results of two individual collectors.

            Assignee:
            Tagir Valeev
            Reporter:
            Tagir Valeev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: