This is the transformation when written in scala -
(Map of type [K, List[V]]).groupBy(_._1).mapValues(_.unzip._2)
This would return a map with keys of all different values of the List and values with a collection of relevant indexes for each such group.
When trying to convert this into java -
One could use Google's guava library's Multimap to replace the .groupBy(_._1) which is -
...collection that maps keys to values, similar to Map, but in which each key may be associated with multiple values.
But that would be a little complicated to accomodate that for each key referring to a number of lists.
How could I perform the same task on a java HashMap<Key, ListArray<T>> in java without deconstructing the entire map and list manually and rebuilding it?