I have a collection, I want to split it by a predicate, the predicate is on the resulting collection.
I want to split this list by strings with common letter.
"Inky", "Blinky", "Pinky", "Pinky", "Clyde"
will result in:
- Inky,Blinky,Pinky - same inky
- Blinky,Clyde - same l
better yet, the result will be map: - 1=Blinky,Clyde - 4=Inky,Blinky,Pinky
on the number of common letters.
The predicate for giving the common letters is easy and I have it. the problem is creating the new collection.
I guess I was unclear, I want to divide the collection to equivalence classes, based on the predicate. the strings were an example. a poor one I guess. in every equivalence class there will be objects that answer: (a,b) such that f(a,b) < X. in my problem the X represents the distance between a,b and I want to divide the graph by nearby vertices.