eclipse-collections icon indicating copy to clipboard operation
eclipse-collections copied to clipboard

Implement RichIterable.toMultimap().

Open nikhilnanivadekar opened this issue 9 years ago • 3 comments

Pull request 37 was to implement Iterate.toMultimap(), however the method should be added on RichIterable itself.

nikhilnanivadekar avatar Feb 09 '16 18:02 nikhilnanivadekar

Full signature:

public <K, V> Multimap<K, V> toMultimap(
    Function<? super T, ? extends K> keyFunction,
    Function<? super T, ? extends Iterable<V>> valuesFunction)

motlin avatar Feb 10 '16 03:02 motlin

@donraab @nikhilnanivadekar @motlin

(Just to avoid confusion, this is Hiroshi, changed my GitHub account in Eclipse Fundation to use itohiro73 instead of itohro)

Seeing this issue as minor-version, I was considering how to make this as a default method in RichIterable, but I think there are couple of challenges.

  1. We cannot decide the variant of Multimap (such as ListMutimap, SetMultimap etc.) at RichIterable level
  2. We cannot instantiate implementation of Multimap from RichIterable as it'll need inverse dependency to impl.

Should this (and other similar methods) be marked back to major-version, or does anyone have any good idea to make it default method in RichIterable?

itohiro73 avatar Jan 31 '18 08:01 itohiro73

If you want to attempt it in a minor version, you'd probably have to only do implementations (no interfaces) or make the default implementation to throw new UnsupportedOperationException and override the default.

If there's a version which takes a target, that one can go on the interfaces.

On Wed, Jan 31, 2018 at 3:15 AM Hiroshi Ito [email protected] wrote:

@donraab https://github.com/donraab @nikhilnanivadekar https://github.com/nikhilnanivadekar @motlin https://github.com/motlin

(Just to avoid confusion, this is Hiroshi, changed my GitHub account in Eclipse Fundation to use itohiro73 instead of itohro)

Seeing this issue as minor-version, I was considering how to make this as a default method in RichIterable, but I think there are couple of challenges.

  1. We cannot decide the variant of Multimap (such as ListMutimap, SetMultimap etc.) at RichIterable level
  2. We cannot instantiate implementation of Multimap from RichIterable as it'll need inverse dependency to impl.

Should this (and other similar methods) be marked back to major-version, or does anyone have any good idea to make it default method in RichIterable?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/eclipse/eclipse-collections/issues/46#issuecomment-361856254, or mute the thread https://github.com/notifications/unsubscribe-auth/AAO6IibPQmDVIerBt0m-hSVDvzxa8ymgks5tQCEogaJpZM4HWqcT .

motlin avatar Jan 31 '18 12:01 motlin