Java Utililty Methods List Null Empty

List of utility methods to do List Null Empty

Description

The list of methods to do List Null Empty are organized into topic(s).

Method

booleanisAllElementsNull(List list)
is All Elements Null
for (Object object : list) {
    if (object != null)
        return false;
return true;
booleanisArrayEmpty(List objList)
is Array Empty
if (objList == null) {
    return true;
if (objList.size() == 0) {
    return true;
return false;
booleanisCollectionListEmpty()
return collection
return collectionList.isEmpty();
booleanisCommentOrEmptyLine(int lineIndex, List linesOfFile)
is Comment Or Empty Line
if (linesOfFile == null || linesOfFile.isEmpty())
    return true;
String lineStr = "";
try {
    lineStr = linesOfFile.get(lineIndex).trim();
} catch (Exception e) {
    return false;
if (lineStr.length() == 0)
    return true;
if (lineStr.indexOf("//") == 0 || lineStr.indexOf("/*") == 0 || lineStr.indexOf("*/") >= 0)
    return true;
int checkIndex = lineIndex - 1;
while (checkIndex >= 0) {
    String previousLineString = linesOfFile.get(checkIndex).trim();
    if (previousLineString.indexOf("/*") == 0)
        return true;
    if (previousLineString.indexOf("*/") >= 0)
        return false;
    checkIndex--;
return false;
booleanisEmpty(Collection list)
is Empty
return list == null || list.isEmpty();
booleanisEmpty(final List aList)
is Empty
return !(isNotEmpty(aList));
booleanisEmpty(final List values, final int position)
is Empty
validate(values, position);
final String value = values.get(position);
return value == null || value.isEmpty();
booleanisEmpty(final List list)
Checks if a List is null or empty.
return list == null || list.isEmpty();
booleanisEmpty(final List objList)
is Empty
if (objList == null || objList.isEmpty()) {
    return true;
return false;
booleanisEmpty(java.util.List list)
Determine whether an List is null or empty.
return list == null || list.size() == 0;