How about
set = Sets.difference(set, ImmutableSet.of("c")).immutableCopy();
It's almost the same thing, of course, but a bit terser and clearer.
--
Craig Berry
Software Engineer
Google (Santa Monica CA)
set = ImmutableSet.copyOf(Sets.difference(set, ImmutableSet.of("c")));
As you can see, I had to create a set with one element in it, then do
a set difference, then wrap the result in an immutable set. Is there a
more direct way to produce the same result?
Perhaps something similar to the builder concept:
set = set.modifer().remove("a").build();
--
guava-...@googlegroups.com.
http://groups.google.com/group/guava-discuss?hl=en
unsubscribe: guava-discus...@googlegroups.com
This list is for discussion; for help, post to Stack Overflow instead:
http://stackoverflow.com/questions/ask
Use the tag "guava".
On Thu, Jun 24, 2010 at 9:40 AM, Kevin Bourrillion <kev...@google.com> wrote:
--
I'll ask for both, along with quite a few other things. :)
What would "built into the language" look like, in your view?
I've had arguments in Google around this based on Josh Bloch's blog post about why Collections didn't go this way. I personally don't mind the proliferation of interfaces, but some find that ugly.