Any big difference between using contains or loop through a list?
- by Nazgulled
Hi,
Performance wise, is there really a big difference between using:
ArrayList.contains(o) vs foreach|iterator
LinkedList.contains(o) vs foreach|iterator
HashMap.(containsKey|containsValue) vs foreach|iterator
TreeMap.(containsKey|containsValue) vs foreach|iterator
Of course, for the foreach|iterator loops, I'll have to explicitly compare the methods and return true or false accordingly.
The object I'm comparing is an object where equals() and hashcode() are both properly overridden.