title: Java why does HashSet's remove() take O(1) time, when ArrayList's remove() takes O(n)?
body: <p>I found out that the remove(Object o) of Java's HashSet take O(1) constant time, whereas the remove(Object o) operation of ArrayList take O(N) where N is the size of ArrayList.</p>
  
  <p>Could anyone please explain, in detail, why that is? </p>