Add `AssociativeArray.contains`

Use it in `EntityCollection` to make the code clearer.