himanshudixit / google-collections

Automatically exported from code.google.com/p/google-collections
Apache License 2.0
0 stars 0 forks source link

Create live uniqueIndex method #212

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I want to be able to create a Map view on a collection with a function to 
calculate the key for each value.

uniqueIndex() is so close, but is not useful for me as I need to update the 
backing collection and recalculate the index (which introduces code instead 
of removing, and is slow).

It would be fantastic to have this as a Collection decorator implementation 
that is able to follow the same contract of the Maps.uniqueIndex() and 
MultiMaps.index() functions. e.g. the decorator would have add*() methods 
that throw the appropriate exceptions and a map/multimap view methods to get 
the index view.

Original issue reported on code.google.com by stephen....@gmail.com on 28 Jul 2009 at 3:47

GoogleCodeExporter commented 9 years ago
FYI, Glazed Lists has this. 
  http://publicobject.com/glazedlists/glazedlists-
1.8.0/api/ca/odell/glazedlists/GlazedLists.html#syncEventListToMap(ca.odell.glaz
edlists.EventList,%20ca.odell.g
lazedlists.FunctionList.Function)

I don't think it makes sense for Google Collections. Each map access would be 
extremely slow because the 
wrapped collections don't publish their changes.

Original comment by limpbizkit on 28 Jul 2009 at 7:52