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.
Create a Hash that is a String and an Integer of the count of how many time. Interate thought the list create a Hash entry and setting to one if element exists already add one to the count.

```
Hash<String, Integer> hash = new HashMap<String, Integer>();
for (String s : list) {
    if (hash.containsKey(s))
        hash.put(s, hash.get(s)++);
    else
        hash.put(s,1);
}

```