Combining several collections into one Is there a way to rewrite this code to make it more laconic? I'm using Java 6.

Object value = methodOutOfMyControl();        
Collection&lt;LinkedHashSet&lt;String&gt;&gt; values = ((Map) value).values();
Set&lt;String&gt; strings = new HashSet&lt;String&gt;();
for (LinkedHashSet&lt;String&gt; set : values) {
    strings.addAll(set);
}
I feel that sometimes inlining some values makes things a little more readable. But in terms of overall compactness, this isn't that much better. Here is what I would probably write

Map value = (Map)methodOutOfMyControl();
Set&lt;String&gt; strings = new HashSet&lt;String&gt;();
for (Map.Entry&lt;Object, LinkedHashSet&lt;String&gt;&gt; set : value.entrySet()) {
    strings.addAll(set.getValue());
}