Check whether list has no elements:
- A
list.isEmpty()
- Bcheck_circle
Both work; isEmpty is more readable
- C
list == null
- D
list.size() == 0
Explanation
Both equivalent; isEmpty() is idiomatic.
AP Computer Science A· difficulty 3/5
Check whether list has no elements:
list.isEmpty()
Both work; isEmpty is more readable
list == null
list.size() == 0
Explanation
Both equivalent; isEmpty() is idiomatic.
Want 10 more like this — adaptive to your weak spots?