Answers for "java return empty list if null"

1

check list for empty and null java

/* 
	If you use the Apache Commons Collections library in your project, 
	you may use 
*/
CollectionUtils.isEmpty(MyList) or MapUtils.isEmpty(MyList) 

/* 
	which respectively check 
	if a collection or a map is empty or null 
	(i.e. they are "null-safe"). 
*/

/*
 Small tip:
 remember that the less code you write, 
 the less code you need to test as the complexity of your code decreases.
*/
Posted by: Guest on September-07-2021

Code answers related to "java return empty list if null"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language