mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-12-07 21:01:16 +01:00
Add MultiMap.flatten()
This commit is contained in:
parent
41d734f2db
commit
324302c536
2 changed files with 34 additions and 0 deletions
|
|
@ -100,6 +100,19 @@ public class MultiMap<K, V> {
|
|||
return map.entrySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all values of the {@link MultiMap} in a single {@link LinkedHashSet}.
|
||||
*
|
||||
* @return set of all values
|
||||
*/
|
||||
public Set<V> flatten() {
|
||||
LinkedHashSet<V> flattened = new LinkedHashSet<>();
|
||||
for (Set<V> items : map.values()) {
|
||||
flattened.addAll(items);
|
||||
}
|
||||
return flattened;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue