Class ConstraintCollectors

    • Method Detail

      • min

        public static <A extends Comparable<A>> UniConstraintCollector<A,​?,​A> min()
        Returns a collector that finds a minimum value in a group of Comparable elements.

        Important: The Comparable's Comparable.compareTo(Object) must be consistent with equals, such that e1.compareTo(e2) == 0 has the same boolean value as e1.equals(e2). In other words, if two elements compare to zero, any of them can be returned by the collector. It can even differ between 2 score calculations on the exact same PlanningSolution state, due to incremental score calculation.

        For example, [Ann(age = 20), Beth(age = 25), Cathy(age = 30), David(age = 30), Eric(age = 20)] with .groupBy(min()) returns either Ann or Eric arbitrarily, assuming the objects are Comparable by the age field. To avoid this, always end your Comparator by an identity comparison, such as Comparator.comparing(Person::getAge).comparing(Person::getId)).

        Type Parameters:
        A - type of the matched fact
        Returns:
        never null
      • min

        public static <A,​Mapped extends Comparable<Mapped>> UniConstraintCollector<A,​?,​Mapped> min​(Function<A,​Mapped> groupValueMapping)
        Returns a collector that finds a minimum value in a group of Comparable elements.

        Important: The Comparable's Comparable.compareTo(Object) must be consistent with equals, such that e1.compareTo(e2) == 0 has the same boolean value as e1.equals(e2). In other words, if two elements compare to zero, any of them can be returned by the collector. It can even differ between 2 score calculations on the exact same PlanningSolution state, due to incremental score calculation.

        For example, [Ann(age = 20), Beth(age = 25), Cathy(age = 30), David(age = 30), Eric(age = 20)] with .groupBy(min(Person::getAge)) returns 20.

        Type Parameters:
        A - type of the matched fact
        Mapped - type of the result
        Parameters:
        groupValueMapping - never null, maps facts from the matched type to the result type
        Returns:
        never null
      • max

        public static <A extends Comparable<A>> UniConstraintCollector<A,​?,​A> max()
        Returns a collector that finds a maximum value in a group of Comparable elements.

        Important: The Comparable's Comparable.compareTo(Object) must be consistent with equals, such that e1.compareTo(e2) == 0 has the same boolean value as e1.equals(e2). In other words, if two elements compare to zero, any of them can be returned by the collector. It can even differ between 2 score calculations on the exact same PlanningSolution state, due to incremental score calculation.

        For example, [Ann(age = 20), Beth(age = 25), Cathy(age = 30), David(age = 30), Eric(age = 20)] with .groupBy(max()) returns either Cathy or David arbitrarily, assuming the objects are Comparable by the age field. To avoid this, always end your Comparator by an identity comparison, such as Comparator.comparing(Person::getAge).comparing(Person::getId)).

        Type Parameters:
        A - type of the matched fact
        Returns:
        never null
      • max

        public static <A,​Mapped extends Comparable<Mapped>> UniConstraintCollector<A,​?,​Mapped> max​(Function<A,​Mapped> groupValueMapping)
        Returns a collector that finds a maximum value in a group of Comparable elements.

        Important: The Comparable's Comparable.compareTo(Object) must be consistent with equals, such that e1.compareTo(e2) == 0 has the same boolean value as e1.equals(e2). In other words, if two elements compare to zero, any of them can be returned by the collector. It can even differ between 2 score calculations on the exact same PlanningSolution state, due to incremental score calculation.

        For example, [Ann(age = 20), Beth(age = 25), Cathy(age = 30), David(age = 30), Eric(age = 20)] with .groupBy(max(Person::getAge)) returns 30.

        Type Parameters:
        A - type of the matched fact
        Mapped - type of the result
        Parameters:
        groupValueMapping - never null, maps facts from the matched type to the result type
        Returns:
        never null
      • toSet

        public static <A> UniConstraintCollector<A,​?,​Set<A>> toSet()
        Creates constraint collector that returns Set of the same element type as the ConstraintStream. Makes no guarantees on iteration order. For stable iteration order, use toSortedSet().
        Type Parameters:
        A - type of the matched fact
        Returns:
        never null
      • toList

        public static <A> UniConstraintCollector<A,​?,​List<A>> toList()
        Creates constraint collector that returns List of the same element type as the ConstraintStream. Makes no guarantees on iteration order. For stable iteration order, use toSortedSet().
        Type Parameters:
        A - type of the matched fact
        Returns:
        never null
      • toSet

        public static <A,​Mapped> UniConstraintCollector<A,​?,​Set<Mapped>> toSet​(Function<A,​Mapped> groupValueMapping)
        Creates constraint collector that returns Set of the same element type as the ConstraintStream. Makes no guarantees on iteration order. For stable iteration order, use toSortedSet().
        Type Parameters:
        A - type of the matched fact
        Mapped - type of elements in the resulting set
        Parameters:
        groupValueMapping - never null, converts matched facts to elements of the resulting set
        Returns:
        never null
      • toSortedSet

        public static <A,​Mapped extends Comparable<Mapped>> UniConstraintCollector<A,​?,​SortedSet<Mapped>> toSortedSet​(Function<A,​Mapped> groupValueMapping)
        Creates constraint collector that returns SortedSet of the same element type as the ConstraintStream.
        Type Parameters:
        A - type of the matched fact
        Mapped - type of elements in the resulting set
        Parameters:
        groupValueMapping - never null, converts matched facts to elements of the resulting set
        Returns:
        never null
      • toList

        public static <A,​Mapped> UniConstraintCollector<A,​?,​List<Mapped>> toList​(Function<A,​Mapped> groupValueMapping)
        Creates constraint collector that returns List of the given element type. Makes no guarantees on iteration order. For stable iteration order, use toSortedSet(Function).
        Type Parameters:
        A - type of the matched fact
        Mapped - type of elements in the resulting collection
        Parameters:
        groupValueMapping - never null, converts matched facts to elements of the resulting collection
        Returns:
        never null
      • toSet

        public static <A,​B,​Mapped> BiConstraintCollector<A,​B,​?,​Set<Mapped>> toSet​(BiFunction<A,​B,​Mapped> groupValueMapping)
        As defined by toSet(Function).
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        Mapped - type of elements in the resulting set
        Parameters:
        groupValueMapping - never null, converts matched facts to elements of the resulting set
        Returns:
        never null
      • toSortedSet

        public static <A,​B,​Mapped extends Comparable<Mapped>> BiConstraintCollector<A,​B,​?,​SortedSet<Mapped>> toSortedSet​(BiFunction<A,​B,​Mapped> groupValueMapping)
        As defined by toSortedSet(Function).
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        Mapped - type of elements in the resulting set
        Parameters:
        groupValueMapping - never null, converts matched facts to elements of the resulting set
        Returns:
        never null
      • toList

        public static <A,​B,​Mapped> BiConstraintCollector<A,​B,​?,​List<Mapped>> toList​(BiFunction<A,​B,​Mapped> groupValueMapping)
        Creates constraint collector that returns List of the given element type. Makes no guarantees on iteration order. For stable iteration order, use toSortedSet(BiFunction).
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        Mapped - type of elements in the resulting collection
        Parameters:
        groupValueMapping - never null, converts matched facts to elements of the resulting collection
        Returns:
        never null
      • toSet

        public static <A,​B,​C,​Mapped> TriConstraintCollector<A,​B,​C,​?,​Set<Mapped>> toSet​(TriFunction<A,​B,​C,​Mapped> groupValueMapping)
        As defined by toSet(Function).
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        Mapped - type of elements in the resulting set
        Parameters:
        groupValueMapping - never null, converts matched facts to elements of the resulting set
        Returns:
        never null
      • toSortedSet

        public static <A,​B,​C,​Mapped extends Comparable<Mapped>> TriConstraintCollector<A,​B,​C,​?,​SortedSet<Mapped>> toSortedSet​(TriFunction<A,​B,​C,​Mapped> groupValueMapping)
        As defined by toSortedSet(Function).
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        Mapped - type of elements in the resulting set
        Parameters:
        groupValueMapping - never null, converts matched facts to elements of the resulting set
        Returns:
        never null
      • toList

        public static <A,​B,​C,​Mapped> TriConstraintCollector<A,​B,​C,​?,​List<Mapped>> toList​(TriFunction<A,​B,​C,​Mapped> groupValueMapping)
        Creates constraint collector that returns List of the given element type. Makes no guarantees on iteration order. For stable iteration order, use toSortedSet(TriFunction).
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        Mapped - type of elements in the resulting collection
        Parameters:
        groupValueMapping - never null, converts matched facts to elements of the resulting collection
        Returns:
        never null
      • toSet

        public static <A,​B,​C,​D,​Mapped> QuadConstraintCollector<A,​B,​C,​D,​?,​Set<Mapped>> toSet​(QuadFunction<A,​B,​C,​D,​Mapped> groupValueMapping)
        As defined by toSet(Function).
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        D - type of the fourth matched fact
        Mapped - type of elements in the resulting set
        Parameters:
        groupValueMapping - never null, converts matched facts to elements of the resulting set
        Returns:
        never null
      • toSortedSet

        public static <A,​B,​C,​D,​Mapped extends Comparable<Mapped>> QuadConstraintCollector<A,​B,​C,​D,​?,​SortedSet<Mapped>> toSortedSet​(QuadFunction<A,​B,​C,​D,​Mapped> groupValueMapping)
        As defined by toSortedSet(Function).
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        D - type of the fourth matched fact
        Mapped - type of elements in the resulting set
        Parameters:
        groupValueMapping - never null, converts matched facts to elements of the resulting set
        Returns:
        never null
      • toList

        public static <A,​B,​C,​D,​Mapped> QuadConstraintCollector<A,​B,​C,​D,​?,​List<Mapped>> toList​(QuadFunction<A,​B,​C,​D,​Mapped> groupValueMapping)
        Creates constraint collector that returns List of the given element type. Makes no guarantees on iteration order. For stable iteration order, use toSortedSet(QuadFunction).
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        D - type of the fourth matched fact
        Mapped - type of elements in the resulting collection
        Parameters:
        groupValueMapping - never null, converts matched facts to elements of the resulting collection
        Returns:
        never null
      • toMap

        public static <A,​Key,​Value> UniConstraintCollector<A,​?,​Map<Key,​Set<Value>>> toMap​(Function<? super A,​? extends Key> keyMapper,
                                                                                                                        Function<? super A,​? extends Value> valueMapper)
        Creates a constraint collector that returns a Map with given keys and values consisting of a Set of mappings.

        For example, [Ann(age = 20), Beth(age = 25), Cathy(age = 30), David(age = 30), Eric(age = 20)] with .groupBy(toMap(Person::getAge, Person::getName)) returns {20: [Ann, Eric], 25: [Beth], 30: [Cathy, David]}.

        Makes no guarantees on iteration order, neither for map entries, nor for the value sets. For stable iteration order, use toSortedMap(Function, Function, IntFunction).

        Type Parameters:
        A - type of the matched fact
        Key - type of map key
        Value - type of map value
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        Returns:
        never null
      • toMap

        public static <A,​Key,​Value,​ValueSet extends Set<Value>> UniConstraintCollector<A,​?,​Map<Key,​ValueSet>> toMap​(Function<? super A,​? extends Key> keyMapper,
                                                                                                                                                        Function<? super A,​? extends Value> valueMapper,
                                                                                                                                                        IntFunction<ValueSet> valueSetFunction)
        Creates a constraint collector that returns a Map with given keys and values consisting of a Set of mappings.

        For example, [Ann(age = 20), Beth(age = 25), Cathy(age = 30), David(age = 30), Eric(age = 20)] with .groupBy(toMap(Person::getAge, Person::getName)) returns {20: [Ann, Eric], 25: [Beth], 30: [Cathy, David]}.

        Iteration order of value collections depends on the Set provided. Makes no guarantees on iteration order for map entries, use toSortedMap(Function, Function, IntFunction) for that.

        Type Parameters:
        A - type of the matched fact
        Key - type of map key
        Value - type of map value
        ValueSet - type of the value set
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        valueSetFunction - creates a set that will be used to store value mappings
        Returns:
        never null
      • toMap

        public static <A,​Key,​Value> UniConstraintCollector<A,​?,​Map<Key,​Value>> toMap​(Function<? super A,​? extends Key> keyMapper,
                                                                                                                   Function<? super A,​? extends Value> valueMapper,
                                                                                                                   BinaryOperator<Value> mergeFunction)
        Creates a constraint collector that returns a Map.

        For example, [Ann(age = 20), Beth(age = 25), Cathy(age = 30), David(age = 30), Eric(age = 20)] with .groupBy(toMap(Person::getAge, Person::getName, (name1, name2) -> name1 + " and " + name2) returns {20: "Ann and Eric", 25: "Beth", 30: "Cathy and David"}.

        Makes no guarantees on iteration order for map entries. For stable iteration order, use toSortedMap(Function, Function, BinaryOperator).

        Type Parameters:
        A - type of the matched fact
        Key - type of map key
        Value - type of map value
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        mergeFunction - takes two values and merges them to one
        Returns:
        never null
      • toSortedMap

        public static <A,​Key extends Comparable<Key>,​Value> UniConstraintCollector<A,​?,​SortedMap<Key,​Set<Value>>> toSortedMap​(Function<? super A,​? extends Key> keyMapper,
                                                                                                                                                            Function<? super A,​? extends Value> valueMapper)
        Creates a constraint collector that returns a SortedMap with given keys and values consisting of a Set of mappings.

        For example, [Ann(age = 20), Beth(age = 25), Cathy(age = 30), David(age = 30), Eric(age = 20)] with .groupBy(toMap(Person::getAge, Person::getName)) returns {20: [Ann, Eric], 25: [Beth], 30: [Cathy, David]}.

        Makes no guarantees on iteration order for the value sets, use toSortedMap(Function, Function, IntFunction) for that.

        Type Parameters:
        A - type of the matched fact
        Key - type of map key
        Value - type of map value
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        Returns:
        never null
      • toSortedMap

        public static <A,​Key extends Comparable<Key>,​Value,​ValueSet extends Set<Value>> UniConstraintCollector<A,​?,​SortedMap<Key,​ValueSet>> toSortedMap​(Function<? super A,​? extends Key> keyMapper,
                                                                                                                                                                                            Function<? super A,​? extends Value> valueMapper,
                                                                                                                                                                                            IntFunction<ValueSet> valueSetFunction)
        Creates a constraint collector that returns a SortedMap with given keys and values consisting of a Set of mappings.

        For example, [Ann(age = 20), Beth(age = 25), Cathy(age = 30), David(age = 30), Eric(age = 20)] with .groupBy(toMap(Person::getAge, Person::getName)) returns {20: [Ann, Eric], 25: [Beth], 30: [Cathy, David]}.

        Iteration order of value collections depends on the Set provided.

        Type Parameters:
        A - type of the matched fact
        Key - type of map key
        Value - type of map value
        ValueSet - type of the value set
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        valueSetFunction - creates a set that will be used to store value mappings
        Returns:
        never null
      • toSortedMap

        public static <A,​Key extends Comparable<Key>,​Value> UniConstraintCollector<A,​?,​SortedMap<Key,​Value>> toSortedMap​(Function<? super A,​? extends Key> keyMapper,
                                                                                                                                                       Function<? super A,​? extends Value> valueMapper,
                                                                                                                                                       BinaryOperator<Value> mergeFunction)
        Creates a constraint collector that returns a SortedMap.

        For example, [Ann(age = 20), Beth(age = 25), Cathy(age = 30), David(age = 30), Eric(age = 20)] with .groupBy(toMap(Person::getAge, Person::getName, (name1, name2) -> name1 + " and " + name2) returns {20: "Ann and Eric", 25: "Beth", 30: "Cathy and David"}.

        Type Parameters:
        A - type of the matched fact
        Key - type of map key
        Value - type of map value
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        mergeFunction - takes two values and merges them to one
        Returns:
        never null
      • toMap

        public static <A,​B,​Key,​Value> BiConstraintCollector<A,​B,​?,​Map<Key,​Set<Value>>> toMap​(BiFunction<? super A,​? super B,​? extends Key> keyMapper,
                                                                                                                                       BiFunction<? super A,​? super B,​? extends Value> valueMapper)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        Key - type of map key
        Value - type of map value
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        Returns:
        never null
      • toMap

        public static <A,​B,​Key,​Value,​ValueSet extends Set<Value>> BiConstraintCollector<A,​B,​?,​Map<Key,​ValueSet>> toMap​(BiFunction<? super A,​? super B,​? extends Key> keyMapper,
                                                                                                                                                                       BiFunction<? super A,​? super B,​? extends Value> valueMapper,
                                                                                                                                                                       IntFunction<ValueSet> valueSetFunction)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        Key - type of map key
        Value - type of map value
        ValueSet - type of the value set
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        valueSetFunction - creates a set that will be used to store value mappings
        Returns:
        never null
      • toMap

        public static <A,​B,​Key,​Value> BiConstraintCollector<A,​B,​?,​Map<Key,​Value>> toMap​(BiFunction<? super A,​? super B,​? extends Key> keyMapper,
                                                                                                                                  BiFunction<? super A,​? super B,​? extends Value> valueMapper,
                                                                                                                                  BinaryOperator<Value> mergeFunction)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        Key - type of map key
        Value - type of map value
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        mergeFunction - takes two values and merges them to one
        Returns:
        never null
      • toSortedMap

        public static <A,​B,​Key extends Comparable<Key>,​Value> BiConstraintCollector<A,​B,​?,​SortedMap<Key,​Set<Value>>> toSortedMap​(BiFunction<? super A,​? super B,​? extends Key> keyMapper,
                                                                                                                                                                           BiFunction<? super A,​? super B,​? extends Value> valueMapper)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        Key - type of map key
        Value - type of map value
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        Returns:
        never null
      • toSortedMap

        public static <A,​B,​Key extends Comparable<Key>,​Value,​ValueSet extends Set<Value>> BiConstraintCollector<A,​B,​?,​SortedMap<Key,​ValueSet>> toSortedMap​(BiFunction<? super A,​? super B,​? extends Key> keyMapper,
                                                                                                                                                                                                           BiFunction<? super A,​? super B,​? extends Value> valueMapper,
                                                                                                                                                                                                           IntFunction<ValueSet> valueSetFunction)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        Key - type of map key
        Value - type of map value
        ValueSet - type of the value set
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        valueSetFunction - creates a set that will be used to store value mappings
        Returns:
        never null
      • toSortedMap

        public static <A,​B,​Key extends Comparable<Key>,​Value> BiConstraintCollector<A,​B,​?,​SortedMap<Key,​Value>> toSortedMap​(BiFunction<? super A,​? super B,​? extends Key> keyMapper,
                                                                                                                                                                      BiFunction<? super A,​? super B,​? extends Value> valueMapper,
                                                                                                                                                                      BinaryOperator<Value> mergeFunction)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        Key - type of map key
        Value - type of map value
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        mergeFunction - takes two values and merges them to one
        Returns:
        never null
      • toMap

        public static <A,​B,​C,​Key,​Value> TriConstraintCollector<A,​B,​C,​?,​Map<Key,​Set<Value>>> toMap​(TriFunction<? super A,​? super B,​? super C,​? extends Key> keyMapper,
                                                                                                                                                        TriFunction<? super A,​? super B,​? super C,​? extends Value> valueMapper)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        Key - type of map key
        Value - type of map value
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        Returns:
        never null
      • toMap

        public static <A,​B,​C,​Key,​Value,​ValueSet extends Set<Value>> TriConstraintCollector<A,​B,​C,​?,​Map<Key,​ValueSet>> toMap​(TriFunction<? super A,​? super B,​? super C,​? extends Key> keyMapper,
                                                                                                                                                                                        TriFunction<? super A,​? super B,​? super C,​? extends Value> valueMapper,
                                                                                                                                                                                        IntFunction<ValueSet> valueSetFunction)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        Key - type of map key
        Value - type of map value
        ValueSet - type of the value set
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        valueSetFunction - creates a set that will be used to store value mappings
        Returns:
        never null
      • toMap

        public static <A,​B,​C,​Key,​Value> TriConstraintCollector<A,​B,​C,​?,​Map<Key,​Value>> toMap​(TriFunction<? super A,​? super B,​? super C,​? extends Key> keyMapper,
                                                                                                                                                   TriFunction<? super A,​? super B,​? super C,​? extends Value> valueMapper,
                                                                                                                                                   BinaryOperator<Value> mergeFunction)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        Key - type of map key
        Value - type of map value
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        mergeFunction - takes two values and merges them to one
        Returns:
        never null
      • toSortedMap

        public static <A,​B,​C,​Key extends Comparable<Key>,​Value> TriConstraintCollector<A,​B,​C,​?,​SortedMap<Key,​Set<Value>>> toSortedMap​(TriFunction<? super A,​? super B,​? super C,​? extends Key> keyMapper,
                                                                                                                                                                                            TriFunction<? super A,​? super B,​? super C,​? extends Value> valueMapper)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        Key - type of map key
        Value - type of map value
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        Returns:
        never null
      • toSortedMap

        public static <A,​B,​C,​Key extends Comparable<Key>,​Value,​ValueSet extends Set<Value>> TriConstraintCollector<A,​B,​C,​?,​SortedMap<Key,​ValueSet>> toSortedMap​(TriFunction<? super A,​? super B,​? super C,​? extends Key> keyMapper,
                                                                                                                                                                                                                            TriFunction<? super A,​? super B,​? super C,​? extends Value> valueMapper,
                                                                                                                                                                                                                            IntFunction<ValueSet> valueSetFunction)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        Key - type of map key
        Value - type of map value
        ValueSet - type of the value set
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        valueSetFunction - creates a set that will be used to store value mappings
        Returns:
        never null
      • toSortedMap

        public static <A,​B,​C,​Key extends Comparable<Key>,​Value> TriConstraintCollector<A,​B,​C,​?,​SortedMap<Key,​Value>> toSortedMap​(TriFunction<? super A,​? super B,​? super C,​? extends Key> keyMapper,
                                                                                                                                                                                       TriFunction<? super A,​? super B,​? super C,​? extends Value> valueMapper,
                                                                                                                                                                                       BinaryOperator<Value> mergeFunction)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        Key - type of map key
        Value - type of map value
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        mergeFunction - takes two values and merges them to one
        Returns:
        never null
      • toMap

        public static <A,​B,​C,​D,​Key,​Value> QuadConstraintCollector<A,​B,​C,​D,​?,​Map<Key,​Set<Value>>> toMap​(QuadFunction<? super A,​? super B,​? super C,​? super D,​? extends Key> keyMapper,
                                                                                                                                                                         QuadFunction<? super A,​? super B,​? super C,​? super D,​? extends Value> valueMapper)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        D - type of the fourth matched fact
        Key - type of map key
        Value - type of map value
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        Returns:
        never null
      • toMap

        public static <A,​B,​C,​D,​Key,​Value,​ValueSet extends Set<Value>> QuadConstraintCollector<A,​B,​C,​D,​?,​Map<Key,​ValueSet>> toMap​(QuadFunction<? super A,​? super B,​? super C,​? super D,​? extends Key> keyMapper,
                                                                                                                                                                                                         QuadFunction<? super A,​? super B,​? super C,​? super D,​? extends Value> valueMapper,
                                                                                                                                                                                                         IntFunction<ValueSet> valueSetFunction)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        D - type of the fourth matched fact
        Key - type of map key
        Value - type of map value
        ValueSet - type of the value set
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        valueSetFunction - creates a set that will be used to store value mappings
        Returns:
        never null
      • toMap

        public static <A,​B,​C,​D,​Key,​Value> QuadConstraintCollector<A,​B,​C,​D,​?,​Map<Key,​Value>> toMap​(QuadFunction<? super A,​? super B,​? super C,​? super D,​? extends Key> keyMapper,
                                                                                                                                                                    QuadFunction<? super A,​? super B,​? super C,​? super D,​? extends Value> valueMapper,
                                                                                                                                                                    BinaryOperator<Value> mergeFunction)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        D - type of the fourth matched fact
        Key - type of map key
        Value - type of map value
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        mergeFunction - takes two values and merges them to one
        Returns:
        never null
      • toSortedMap

        public static <A,​B,​C,​D,​Key extends Comparable<Key>,​Value> QuadConstraintCollector<A,​B,​C,​D,​?,​SortedMap<Key,​Set<Value>>> toSortedMap​(QuadFunction<? super A,​? super B,​? super C,​? super D,​? extends Key> keyMapper,
                                                                                                                                                                                                             QuadFunction<? super A,​? super B,​? super C,​? super D,​? extends Value> valueMapper)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        D - type of the fourth matched fact
        Key - type of map key
        Value - type of map value
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        Returns:
        never null
      • toSortedMap

        public static <A,​B,​C,​D,​Key extends Comparable<Key>,​Value,​ValueSet extends Set<Value>> QuadConstraintCollector<A,​B,​C,​D,​?,​SortedMap<Key,​ValueSet>> toSortedMap​(QuadFunction<? super A,​? super B,​? super C,​? super D,​? extends Key> keyMapper,
                                                                                                                                                                                                                                             QuadFunction<? super A,​? super B,​? super C,​? super D,​? extends Value> valueMapper,
                                                                                                                                                                                                                                             IntFunction<ValueSet> valueSetFunction)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        D - type of the fourth matched fact
        Key - type of map key
        Value - type of map value
        ValueSet - type of the value set
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        valueSetFunction - creates a set that will be used to store value mappings
        Returns:
        never null
      • toSortedMap

        public static <A,​B,​C,​D,​Key extends Comparable<Key>,​Value> QuadConstraintCollector<A,​B,​C,​D,​?,​SortedMap<Key,​Value>> toSortedMap​(QuadFunction<? super A,​? super B,​? super C,​? super D,​? extends Key> keyMapper,
                                                                                                                                                                                                        QuadFunction<? super A,​? super B,​? super C,​? super D,​? extends Value> valueMapper,
                                                                                                                                                                                                        BinaryOperator<Value> mergeFunction)
        Type Parameters:
        A - type of the first matched fact
        B - type of the second matched fact
        C - type of the third matched fact
        D - type of the fourth matched fact
        Key - type of map key
        Value - type of map value
        Parameters:
        keyMapper - map matched fact to a map key
        valueMapper - map matched fact to a value
        mergeFunction - takes two values and merges them to one
        Returns:
        never null