Question: I have an `ArrayList<SomeObject>` in java which contains some `<SomeObject>` multiple times.
I also have a `Set<SomeObject>`, which contains some elements one time only. The elements are only uniquely distinguishable only by their name (`String SomeObject.Name`).

How am I possible to see if the list has exactly the same elements as the set, but maybe multiple times?

Thanks

Answer: 
It seems like the simplest one-line solution to this is probably

```
return new HashSet<SomeObject>(list).equals(set);

```

...which just identifies the unique elements of `list` and verifies that that matches `set` exactly.
All Java collections have method `boolean containsAll(collection<>)`, so if we want to check if two collections contain same elements, we can write `collection1.containsAll(collection2) && collection2.containsAll(collection1)` which will return `true` if `collection1` and `collection2` contain same elements.