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,439
  • 1
  • 15
  • 30
clankill3r
  • 9,146
  • 20
  • 70
  • 126
  • 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