+ 2

About java source code

ArrayList.set(index,element) public E set(int index,E element) { rangeCheck(index); E oldValue = elementDate(index); elementDate[index] = element; return oldValue; } Why does it need to return oldValue?

7th May 2018, 11:38 AM
LiDazhao
LiDazhao - avatar
1 Resposta
+ 1
Because the return type isn’t void
7th May 2018, 12:31 PM
TurtleShell
TurtleShell - avatar