There are 2 overridden methods in ArrayList:
public boolean add(E e)
public void add(int index, E element)
What are the general rules, according to which add(longArg)
cannot box it and call add(E e)
, giving me compile error (thus actually prohibiting me from overloded call to add(E e)
:
ArrayList<Long> lst = new ArrayList<>();
lst.add(2); // c.ERR, see below
// method add(int, Long) in the type ArrayList<Long>
// is not applicable for the arguments (int)
P.S. Eclipse (SE7) compiler.