The `ArrayList.contains()` call is O(n).