Returns the list when it is not null. Returns a new list otherwise.

@param list The list to process, can be null
@return The input list when it is not null, a new list otherwise
771941
public static <T> List<T> createWhenNull(final List<T> list) {
        if (list == null) {
            return new ArrayList<T>();
        } else {
            return list;
        }
    }
58305
public static <T> List<T> coerceNullToEmpty(List<T> list) {
    return MoreObjects.firstNonNull(list, ImmutableList.<T>of());
  }
773917
List<? extends E> list() {
		List<E> result = new ArrayList<E>();
		while (hasNext()) {
			result.add(next());
		}
		return result;
	}
476551
private <T> T getOne(List<T> list) {
        if (list.size() == 1) {
            return list.get(0);
        } else if (list.size() > 1) {
            throw new TooManyResultsException("Expected one result (or null) to be returned by selectOne()," +
                    " but found: " + list
                    .size());
        } else {
            return null;
        }
    }
115744
@SuppressWarnings("unchecked")
    @NonNull
    public static <T> List<T> unmodifiableNonNullList(@Nullable List<T> list) {
        return list == null || list.isEmpty()
                ? (List<T>) emptyList()
                : unmodifiableList(list);
    }
1057975
public static <T> List<T> tail(List<T> list)
	{
		if (list.isEmpty())
			return Collections.emptyList();
		else
			return list.subList(1, list.size());
	}
964882
private static <T> List<T> unmodifiableList(List<T> list) {
        if (list == null) {
            return Collections.emptyList();
        }
        return Collections.unmodifiableList(list);
    }
1362374
public static ArrayList<String> getInternedList(List<String> oldList) {
        ArrayList<String> newList = new ArrayList<String>(oldList.size());
        for (String elem : oldList) {
            newList.add(elem.intern());
        }
        return newList;
    }
222506
public String join(List<String> list) {

        if (list == null) {
            return null;
        }

        StringBuilder sb = new StringBuilder();
        boolean first = true;
        for (String s : list) {

            if (s == null) {
                if (convertEmptyToNull) {
                    s = "";
                } else {
                    throw new IllegalArgumentException("StringListFlattener does not support null strings in the list. Consider calling setConvertEmptyToNull(true).");
                }
            }

            if (!first) {
                sb.append(separator);
            }

            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                if (c == escapeChar || c == separator) {
                    sb.append(escapeChar);
                }
                sb.append(c);
            }

            first = false;
        }
        return sb.toString();
    }
364620
public List<String> getList(String key) {
    if (!containsKey(key)) {
      throw new IllegalArgumentException("Missing key " + key + ".");
    }
    return getList(key, null);
  }
916237
@Nullable
    public static String[] nullableArrayOfStringsFromListOfStrings(@Nullable List<String> list) {
        return list == null || list.isEmpty()
                ? null
                : list.toArray(new String[list.size()]);
    }
791669
@SuppressWarnings({"rawtypes", "unchecked"})
    public static List getCloneList(List sourceList) {
        if (null == sourceList) {
            return null;
        }
        List targetList = new ArrayList();
        for (int i = 0; i < sourceList.size(); i++) {
            Object target = null;
            Object source = sourceList.get(i);
            try {
                Constructor con = source.getClass().getConstructor();
                target = con.newInstance();
                PropertyUtils.copyProperties(target, source);
            } catch (Exception e) {
                logger.error("clone object exception object class:" + source.getClass(), e);
            }
            targetList.add(target);
        }
        return targetList;
    }
622685
public static <T> List<T> toList(Iterable<T> iterable) {
        List<T> list = null;

        if (iterable != null) {
            list = new ArrayList<>();
            for (T elem : iterable) {
                list.add(elem);
            }
        }

        return list;
    }
1270726
public static <T> MatrixCursor getCursor(final List<T> list) {
        if (list == null || list.isEmpty())
            return new MatrixCursor(new String[] { "_id" });

        final String[] titles = getFieldTitlesFromObject(list.get(0));

        final MatrixCursor cursor = new MatrixCursor(titles);

        try {
            addFieldValuesFromList(cursor, list);
        } catch (final IllegalAccessException e) {
            Logger.ex(e);
        }

        return cursor;
    }
838381
public static <T> List<T> removeDuplicates(final List<T> list) {
        final List<Class> registered = Lists.newArrayList();
        final Iterator it = list.iterator();
        while (it.hasNext()) {
            final Class type = it.next().getClass();
            if (registered.contains(type)) {
                it.remove();
            } else {
                registered.add(type);
            }
        }
        return list;
    }
479232
public static int indexOfNull (Object[] list)
    {
        if (list != null) {
            for (int ii=0, nn = list.length; ii < nn; ii++) {
                if (list[ii] == null) {
                    return ii;
                }
            }
        }
        return -1;
    }
411529
public static int[] unbox (Collection<Integer> list)
    {
        if (list == null) {
            return null;
        }
        int[] unboxed = new int[list.size()];
        int ii = 0;
        for (Integer value : list) {
            unboxed[ii++] = value;
        }
        return unboxed;
    }