Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Test {
- public List<String> getListWithNull() {
- return null;
- }
- public List<String> getList() {
- return Collections.emptyList();
- }
- public Map<String, String> getMap() {
- return Collections.EMPTY_MAP;
- }
- public static void main(String[] args) {
- Test test = new Test();
- List<String> strings = test.getList();
- for (String i:strings)
- System.out.println(i);
- if(!strings.isEmpty())
- // do
- List<String> stringnull=test.getListWithNull();
- if(stringnull!=null)
- // do
- }}
Add Comment
Please, Sign In to add comment