5

For ArrayList we have:

public boolean add(E e) {

but for remove we have:

public boolean remove(Object o) {

Why isn't it?:

public boolean remove(E e) {
Ankush soni
  • 1,388
  • 1
  • 14
  • 30
clankill3r
  • 8,471
  • 17
  • 67
  • 115
  • 2
    ArrayList Remove method call o.equals(elementData[index]) and Object equals returns (this == obj), which actually check references equality, if we pass E in the remove method o.equals will be specific to Generic E. – Ankush soni Aug 04 '15 at 11:15

0 Answers0