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

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -