Skip to content

Instantly share code, notes, and snippets.

@moshekarmel1
Last active August 29, 2015 14:22
Show Gist options
  • Save moshekarmel1/64d18319619d51c1e074 to your computer and use it in GitHub Desktop.
Save moshekarmel1/64d18319619d51c1e074 to your computer and use it in GitHub Desktop.
List<Object> myList = new ArrayList<>();
//This line will throw an ERROR incompatible types required: boolean found: List<Object>
if(myList){//basically you need a boolean expression inside the if...
}
if(myList != null){//works fine because checking against null returns a boolean
//do stuff
}
//the one trick you can do, is to check for a truthy boolean
boolean bool = true;
if(bool){
//this code will get run even without checking for (bool == true)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment