Skip to content

Instantly share code, notes, and snippets.

@ShmuelMofrad
Created November 29, 2017 18:24
Show Gist options
  • Save ShmuelMofrad/70b769fac31bd5c5b34e885aebbc4644 to your computer and use it in GitHub Desktop.
Save ShmuelMofrad/70b769fac31bd5c5b34e885aebbc4644 to your computer and use it in GitHub Desktop.
This class has checked whether a list is null
import java.util.Collections;
import java.util.List;
public class ListIsNotNull {
public static void main(String[] args) {
if(myList() != null) {
System.out.println(true);
} else {
System.out.println(false);
}
}
/* @return a immutable List object */
public static List<String> myList() {
return Collections.emptyList();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment