Created
November 29, 2017 18:24
-
-
Save ShmuelMofrad/70b769fac31bd5c5b34e885aebbc4644 to your computer and use it in GitHub Desktop.
This class has checked whether a list is null
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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