Interface UniEnumeratingStream<Solution_,A>
- All Superinterfaces:
EnumeratingStream
- All Known Implementing Classes:
AbstractUniEnumeratingStream,AftBridgeUniEnumeratingStream,ForEachIncludingPinnedEnumeratingStream,ForeBridgeUniEnumeratingStream
-
Method Summary
Modifier and TypeMethodDescriptiondistinct()Transforms the stream in such a way that all the tuples going through it are distinct.filter(UniNeighborhoodsPredicate<Solution_, A> filter) Exhaustively test each fact against theUniNeighborhoodsPredicateand match ifUniNeighborhoodsPredicate.test(SolutionView, Object)returns true.default <B> UniEnumeratingStream<Solution_,A> ifExists(UniEnumeratingStream<Solution_, B> otherStream) As defined byifExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]), with the array being empty.default <B> UniEnumeratingStream<Solution_,A> ifExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner) As defined byifExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]).ifExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B>... joiners) Create a newUniEnumeratingStreamfor every A where B exists for which allBiNeighborhoodsJoiners are true (for the properties it extracts from both facts).default <B> UniEnumeratingStream<Solution_,A> ifExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2) As defined byifExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]).default <B> UniEnumeratingStream<Solution_,A> ifExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3) As defined byifExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]).default <B> UniEnumeratingStream<Solution_,A> ifExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3, BiNeighborhoodsJoiner<A, B> joiner4) As defined byifExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]).default <B> UniEnumeratingStream<Solution_,A> As defined byifExists(Class, BiNeighborhoodsJoiner[]), with the array being empty.default <B> UniEnumeratingStream<Solution_,A> ifExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner) As defined byifExists(Class, BiNeighborhoodsJoiner[]).ifExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B>... joiners) Create a newUniEnumeratingStreamfor every A where B exists for which allBiNeighborhoodsJoiners are true (for the properties they extract from both facts).default <B> UniEnumeratingStream<Solution_,A> ifExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2) As defined byifExists(Class, BiNeighborhoodsJoiner[]).default <B> UniEnumeratingStream<Solution_,A> ifExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3) As defined byifExists(Class, BiNeighborhoodsJoiner[]).default <B> UniEnumeratingStream<Solution_,A> ifExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3, BiNeighborhoodsJoiner<A, B> joiner4) As defined byifExists(Class, BiNeighborhoodsJoiner[]).default <B> UniEnumeratingStream<Solution_,A> ifNotExists(UniEnumeratingStream<Solution_, B> otherStream) As defined byifNotExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]), with the array being empty.default <B> UniEnumeratingStream<Solution_,A> ifNotExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner) As defined byifNotExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]).ifNotExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B>... joiners) Create a newUniEnumeratingStreamfor every A where B does not exist for which theBiNeighborhoodsJoiners are true (for the properties they extract from both facts).default <B> UniEnumeratingStream<Solution_,A> ifNotExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2) As defined byifNotExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]).default <B> UniEnumeratingStream<Solution_,A> ifNotExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3) As defined byifNotExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]).default <B> UniEnumeratingStream<Solution_,A> ifNotExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3, BiNeighborhoodsJoiner<A, B> joiner4) As defined byifNotExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]).default <B> UniEnumeratingStream<Solution_,A> ifNotExists(Class<B> otherClass) As defined byifNotExists(Class, BiNeighborhoodsJoiner[]), with the array being empty.default <B> UniEnumeratingStream<Solution_,A> ifNotExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner) As defined byifNotExists(Class, BiNeighborhoodsJoiner[]).ifNotExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B>... joiners) Create a newUniEnumeratingStreamfor every A where B does not exist for which theBiNeighborhoodsJoiners are true (for the properties they extract from both facts).default <B> UniEnumeratingStream<Solution_,A> ifNotExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2) As defined byifNotExists(Class, BiNeighborhoodsJoiner[]).default <B> UniEnumeratingStream<Solution_,A> ifNotExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3) As defined byifNotExists(Class, BiNeighborhoodsJoiner[]).default <B> UniEnumeratingStream<Solution_,A> ifNotExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3, BiNeighborhoodsJoiner<A, B> joiner4) As defined byifNotExists(Class, BiNeighborhoodsJoiner[]).default <B> BiEnumeratingStream<Solution_,A, B> join(UniEnumeratingStream<Solution_, B> otherStream) As defined byjoin(UniEnumeratingStream, BiNeighborhoodsJoiner[]), with the array being empty.default <B> BiEnumeratingStream<Solution_,A, B> join(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner) As defined byjoin(UniEnumeratingStream, BiNeighborhoodsJoiner[]).<B> BiEnumeratingStream<Solution_,A, B> join(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B>... joiners) Create a newBiEnumeratingStreamfor every combination of A and B for which theBiNeighborhoodsJoineris true (for the properties it extracts from both facts).default <B> BiEnumeratingStream<Solution_,A, B> join(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2) As defined byjoin(UniEnumeratingStream, BiNeighborhoodsJoiner[]).default <B> BiEnumeratingStream<Solution_,A, B> join(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3) As defined byjoin(UniEnumeratingStream, BiNeighborhoodsJoiner[]).default <B> BiEnumeratingStream<Solution_,A, B> join(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3, BiNeighborhoodsJoiner<A, B> joiner4) As defined byjoin(UniEnumeratingStream, BiNeighborhoodsJoiner[]).default <B> BiEnumeratingStream<Solution_,A, B> As defined byjoin(Class, BiNeighborhoodsJoiner[]), with the array being empty.default <B> BiEnumeratingStream<Solution_,A, B> join(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner) As defined byjoin(Class, BiNeighborhoodsJoiner[])<B> BiEnumeratingStream<Solution_,A, B> join(Class<B> otherClass, BiNeighborhoodsJoiner<A, B>... joiners) Create a newBiEnumeratingStreamfor every combination of A and B for which theBiNeighborhoodsJoineris true (for the properties it extracts from both facts).default <B> BiEnumeratingStream<Solution_,A, B> join(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2) As defined byjoin(Class, BiNeighborhoodsJoiner[])default <B> BiEnumeratingStream<Solution_,A, B> join(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3) As defined byjoin(Class, BiNeighborhoodsJoiner[])default <B> BiEnumeratingStream<Solution_,A, B> join(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3, BiNeighborhoodsJoiner<A, B> joiner4) As defined byjoin(Class, BiNeighborhoodsJoiner[])<ResultA_> UniEnumeratingStream<Solution_,ResultA_> map(UniNeighborhoodsMapper<Solution_, A, ResultA_> mapping) Transforms the stream in such a way that tuples are remapped using the given function.<ResultA_,ResultB_>
BiEnumeratingStream<Solution_,ResultA_, ResultB_> map(UniNeighborhoodsMapper<Solution_, A, ResultA_> mappingA, UniNeighborhoodsMapper<Solution_, A, ResultB_> mappingB) As defined bymap(UniNeighborhoodsMapper), only resulting inBiEnumeratingStream.
-
Method Details
-
filter
Exhaustively test each fact against theUniNeighborhoodsPredicateand match ifUniNeighborhoodsPredicate.test(SolutionView, Object)returns true. -
join
As defined byjoin(UniEnumeratingStream, BiNeighborhoodsJoiner[]), with the array being empty. -
join
default <B> BiEnumeratingStream<Solution_,A, joinB> (UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner) As defined byjoin(UniEnumeratingStream, BiNeighborhoodsJoiner[]). -
join
default <B> BiEnumeratingStream<Solution_,A, joinB> (UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2) As defined byjoin(UniEnumeratingStream, BiNeighborhoodsJoiner[]). -
join
default <B> BiEnumeratingStream<Solution_,A, joinB> (UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3) As defined byjoin(UniEnumeratingStream, BiNeighborhoodsJoiner[]). -
join
default <B> BiEnumeratingStream<Solution_,A, joinB> (UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3, BiNeighborhoodsJoiner<A, B> joiner4) As defined byjoin(UniEnumeratingStream, BiNeighborhoodsJoiner[]). -
join
<B> BiEnumeratingStream<Solution_,A, joinB> (UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B>... joiners) Create a newBiEnumeratingStreamfor every combination of A and B for which theBiNeighborhoodsJoineris true (for the properties it extracts from both facts).Important: Joining is faster and more scalable than a
filter, because it applies hashing and/or indexing on the properties, so it doesn't create nor checks every combination of A and B.- Type Parameters:
B- the type of the second matched fact- Returns:
- a stream that matches every combination of A and B for which the
BiNeighborhoodsJoineris true
-
join
As defined byjoin(Class, BiNeighborhoodsJoiner[]), with the array being empty. -
join
default <B> BiEnumeratingStream<Solution_,A, joinB> (Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner) As defined byjoin(Class, BiNeighborhoodsJoiner[]) -
join
default <B> BiEnumeratingStream<Solution_,A, joinB> (Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2) As defined byjoin(Class, BiNeighborhoodsJoiner[]) -
join
default <B> BiEnumeratingStream<Solution_,A, joinB> (Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3) As defined byjoin(Class, BiNeighborhoodsJoiner[]) -
join
default <B> BiEnumeratingStream<Solution_,A, joinB> (Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3, BiNeighborhoodsJoiner<A, B> joiner4) As defined byjoin(Class, BiNeighborhoodsJoiner[]) -
join
<B> BiEnumeratingStream<Solution_,A, joinB> (Class<B> otherClass, BiNeighborhoodsJoiner<A, B>... joiners) Create a newBiEnumeratingStreamfor every combination of A and B for which theBiNeighborhoodsJoineris true (for the properties it extracts from both facts). The stream will include all facts or entities of the given class, regardless of their pinning status.Important: Joining is faster and more scalable than a
filter, because it applies hashing and/or indexing on the properties, so it doesn't create nor checks every combination of A and B.- Type Parameters:
B- the type of the second matched fact- Returns:
- a stream that matches every combination of A and B for which the
BiNeighborhoodsJoineris true
-
ifExists
default <B> UniEnumeratingStream<Solution_,A> ifExists(UniEnumeratingStream<Solution_, B> otherStream) As defined byifExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]), with the array being empty. -
ifExists
default <B> UniEnumeratingStream<Solution_,A> ifExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner) As defined byifExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]). -
ifExists
default <B> UniEnumeratingStream<Solution_,A> ifExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2) As defined byifExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]). -
ifExists
default <B> UniEnumeratingStream<Solution_,A> ifExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3) As defined byifExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]). -
ifExists
default <B> UniEnumeratingStream<Solution_,A> ifExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3, BiNeighborhoodsJoiner<A, B> joiner4) As defined byifExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]). -
ifExists
<B> UniEnumeratingStream<Solution_,A> ifExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B>... joiners) Create a newUniEnumeratingStreamfor every A where B exists for which allBiNeighborhoodsJoiners are true (for the properties it extracts from both facts).- Type Parameters:
B- the type of the second matched fact- Returns:
- a stream that matches every A where B exists for which the
BiNeighborhoodsJoiners are true
-
ifExists
As defined byifExists(Class, BiNeighborhoodsJoiner[]), with the array being empty. -
ifExists
default <B> UniEnumeratingStream<Solution_,A> ifExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner) As defined byifExists(Class, BiNeighborhoodsJoiner[]). -
ifExists
default <B> UniEnumeratingStream<Solution_,A> ifExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2) As defined byifExists(Class, BiNeighborhoodsJoiner[]). -
ifExists
default <B> UniEnumeratingStream<Solution_,A> ifExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3) As defined byifExists(Class, BiNeighborhoodsJoiner[]). -
ifExists
default <B> UniEnumeratingStream<Solution_,A> ifExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3, BiNeighborhoodsJoiner<A, B> joiner4) As defined byifExists(Class, BiNeighborhoodsJoiner[]). -
ifExists
<B> UniEnumeratingStream<Solution_,A> ifExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B>... joiners) Create a newUniEnumeratingStreamfor every A where B exists for which allBiNeighborhoodsJoiners are true (for the properties they extract from both facts).- Type Parameters:
B- the type of the second matched fact- Returns:
- a stream that matches every A where B exists for which the
BiNeighborhoodsJoiners are true
-
ifNotExists
default <B> UniEnumeratingStream<Solution_,A> ifNotExists(UniEnumeratingStream<Solution_, B> otherStream) As defined byifNotExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]), with the array being empty. -
ifNotExists
default <B> UniEnumeratingStream<Solution_,A> ifNotExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner) As defined byifNotExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]). -
ifNotExists
default <B> UniEnumeratingStream<Solution_,A> ifNotExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2) As defined byifNotExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]). -
ifNotExists
default <B> UniEnumeratingStream<Solution_,A> ifNotExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3) As defined byifNotExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]). -
ifNotExists
default <B> UniEnumeratingStream<Solution_,A> ifNotExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3, BiNeighborhoodsJoiner<A, B> joiner4) As defined byifNotExists(UniEnumeratingStream, BiNeighborhoodsJoiner[]). -
ifNotExists
<B> UniEnumeratingStream<Solution_,A> ifNotExists(UniEnumeratingStream<Solution_, B> otherStream, BiNeighborhoodsJoiner<A, B>... joiners) Create a newUniEnumeratingStreamfor every A where B does not exist for which theBiNeighborhoodsJoiners are true (for the properties they extract from both facts).- Type Parameters:
B- the type of the second matched fact- Returns:
- a stream that matches every A where B does not exist for which the
BiNeighborhoodsJoiners are true
-
ifNotExists
As defined byifNotExists(Class, BiNeighborhoodsJoiner[]), with the array being empty. -
ifNotExists
default <B> UniEnumeratingStream<Solution_,A> ifNotExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner) As defined byifNotExists(Class, BiNeighborhoodsJoiner[]). -
ifNotExists
default <B> UniEnumeratingStream<Solution_,A> ifNotExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2) As defined byifNotExists(Class, BiNeighborhoodsJoiner[]). -
ifNotExists
default <B> UniEnumeratingStream<Solution_,A> ifNotExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3) As defined byifNotExists(Class, BiNeighborhoodsJoiner[]). -
ifNotExists
default <B> UniEnumeratingStream<Solution_,A> ifNotExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B> joiner1, BiNeighborhoodsJoiner<A, B> joiner2, BiNeighborhoodsJoiner<A, B> joiner3, BiNeighborhoodsJoiner<A, B> joiner4) As defined byifNotExists(Class, BiNeighborhoodsJoiner[]). -
ifNotExists
<B> UniEnumeratingStream<Solution_,A> ifNotExists(Class<B> otherClass, BiNeighborhoodsJoiner<A, B>... joiners) Create a newUniEnumeratingStreamfor every A where B does not exist for which theBiNeighborhoodsJoiners are true (for the properties they extract from both facts).- Type Parameters:
B- the type of the second matched fact- Returns:
- a stream that matches every A where B does not exist for which the
BiNeighborhoodsJoiners are true
-
map
<ResultA_> UniEnumeratingStream<Solution_,ResultA_> map(UniNeighborhoodsMapper<Solution_, A, ResultA_> mapping) Transforms the stream in such a way that tuples are remapped using the given function. This may produce a stream with duplicate tuples. Seedistinct()for details.There are several recommendations for implementing the mapping function:
- Purity. The mapping function should only depend on its input. That is, given the same input, it always returns the same output.
- Bijectivity.
No two input tuples should map to the same output tuple,
or to tuples that are
equal. Not following this recommendation creates a enumerating stream with duplicate tuples, and may force you to usedistinct()later, which comes at a performance cost. - Immutable data carriers.
The objects returned by the mapping function should be identified by their contents and nothing else.
If two of them have contents which
equal, then they should likewiseequaland preferably be the same instance. The objects returned by the mapping function should also be immutable, meaning their contents should not be allowed to change.
Simple example: assuming a enumerating stream of tuples of
Persons[Ann(age = 20), Beth(age = 25), Cathy(age = 30)], callingmap(Person::getAge)on such stream will produce a stream ofIntegers[20, 25, 30],Example with a non-bijective mapping function: assuming a enumerating stream of tuples of
Persons[Ann(age = 20), Beth(age = 25), Cathy(age = 30), David(age = 30), Eric(age = 20)], callingmap(Person::getAge)on such stream will produce a stream ofIntegers[20, 25, 30, 30, 20].Use with caution, as the increased memory allocation rates coming from tuple creation may negatively affect performance.
- Type Parameters:
ResultA_- the type of the only fact in the resultingUniEnumeratingStream's tuple- Parameters:
mapping- function to convert the original tuple into the new tuple
-
map
<ResultA_,ResultB_> BiEnumeratingStream<Solution_,ResultA_, mapResultB_> (UniNeighborhoodsMapper<Solution_, A, ResultA_> mappingA, UniNeighborhoodsMapper<Solution_, A, ResultB_> mappingB) As defined bymap(UniNeighborhoodsMapper), only resulting inBiEnumeratingStream.- Type Parameters:
ResultA_- the type of the first fact in the resultingBiEnumeratingStream's tupleResultB_- the type of the first fact in the resultingBiEnumeratingStream's tuple- Parameters:
mappingA- function to convert the original tuple into the first fact of a new tuplemappingB- function to convert the original tuple into the second fact of a new tuple
-
distinct
UniEnumeratingStream<Solution_,A> distinct()Transforms the stream in such a way that all the tuples going through it are distinct. (No two tuples willequal.)By default, tuples going through an enumerating stream are distinct. However, operations such as
map(UniNeighborhoodsMapper)may create a stream which breaks that promise. By calling this method on such a stream, duplicate copies of the same tuple will be omitted at a performance cost.
-