What is the difference null and isEmpty

isEmpty and null difference:

1.isEmpty whether the object is empty (IsNull), null is the null value (the IsEmpty)

2.isEmpty () is used to determine whether List is empty, you must do that if not the list itself is null references;
null used to determine there is no such collection of objects;

Is empty IsNull function:
Function: returns a Boolean value indicating whether the expression contains no valid data. NULL indicates that the data value is unknown or unavailable, it does not represent a zero (or binary digital value), a blank or zero-length string (character values).
IsEmpty function:
Function: a variable for determining whether or not initialized, if the variable is not explicitly initialized or set to Empty, the function IsEmpty returns True; otherwise the function returns False.

Under normal circumstances two will be used in combination:

	if (pageStr == null || pageStr.trim().isEmpty()) {
			pageStr = "1";
		}
		if (rowsStr == null || rowsStr.trim().isEmpty()) {
			rowsStr = "3";
		}

For Chestnut said that if a container, null is used to determine that there is no container, and this container isEmpty is to determine the contents of this container there something that is not empty!

Guess you like

Origin blog.csdn.net/MacWx/article/details/93460684