maidh91 / guava-libraries

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

RFE: SetMaker/ListMaker for e.g. creating lazy sets/lists #472

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be great if there would be a class analoguous to MapMaker for Sets and 
Lists. One frequent use case is computing sets when writing factories that have 
to return the same instance for identical construction parameters.

Original issue reported on code.google.com by harmathdenes on 7 Nov 2010 at 1:37

GoogleCodeExporter commented 9 years ago
But can't you model it as a Map<ConstructionParameters, Instance>?

Original comment by jim.andreou on 7 Nov 2010 at 5:43

GoogleCodeExporter commented 9 years ago
I could, if Guava had tuples. :)

Original comment by harmathdenes on 7 Nov 2010 at 6:13

GoogleCodeExporter commented 9 years ago
Don't be shy, roll your own, everybody does :)

Original comment by jim.andreou on 7 Nov 2010 at 9:32

GoogleCodeExporter commented 9 years ago
If you want a concurrent set, just make a concurrent map using MapMaker and 
then call Sets.newSetFromMap(concurrentMap);

Original comment by kurt.kluever on 8 Nov 2010 at 6:33

GoogleCodeExporter commented 9 years ago
That said, SetMaker is coming soon enough anyway.  A ListMaker with equivalent 
functionality to these is nowhere on the horizon, though; the List type doesn't 
mesh well with references, concurrency, etc.

Original comment by kevinb@google.com on 9 Nov 2010 at 7:38

GoogleCodeExporter commented 9 years ago
"One frequent use case is computing sets when writing factories that have to 
return the same instance for identical construction parameters."  -- if you 
don't want to think of this as a Map<ConstructionParameters, Instance>, then I 
think what you want is our Interner; have you tried it?

I'm realizing that the SetMaker we're working on may not have any connection to 
this particular request.

Original comment by kevinb@google.com on 12 Jan 2011 at 11:09

GoogleCodeExporter commented 9 years ago
This bug needs clarification in order to stay open.

We are working on a SetMaker, but that's little more than a MapMaker that wraps 
in newSetFromMap() when it's done; it doesn't sound like what you're looking 
for (which may be an interner).

Original comment by kevinb@google.com on 26 Jan 2011 at 2:53

GoogleCodeExporter commented 9 years ago

Original comment by kevinb@google.com on 27 Jan 2011 at 6:00

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:15

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:09