java - How to know if specified object in ArrayList is null? -
i want know if object in arraylist null. if it's null, shouldn't anything. example:
if(!(thelist.get(theindexofobject) == null)){ something... } else{ nothing... } this doesn't work, because throws exception cause of '.get()'-method. ideas solve problem?
use contains() method of list:
boolean contains(object o)
Comments
Post a Comment