Java Utililty Methods List First Item

List of utility methods to do List First Item

Description

The list of methods to do List First Item are organized into topic(s).

Method

TgetFirst(List source)
get First
return source.isEmpty() ? null : source.get(0);
StringgetFirstAsString(Map> multiValueMap, String key)
get First As String
return getFirstAsString(multiValueMap, key, false);
ListgetFirstColumn(List> llo, String reason)
Gets the first column.
return getNthColumn(llo, 0, reason);
StringgetFirstDuplicateValue(List values)
get First Duplicate Value
String message = null;
int size = values.size();
for (int i = 0; i < size; i++) {
    String col1 = values.get(i);
    for (int j = i + 1; j < size; j++) {
        String col2 = values.get(j);
        if (col1.equals(col2)) {
            message = col1;
...
TgetFirstElement(List list)
get First Element
for (int i = 0; i < list.size(); i++) {
    T obj = list.get(i);
    if (obj != null)
        return obj;
return null;
TgetFirstElement(List collection)
get First Element
return collection.iterator().next();
TgetFirstElement(List list)
get First Element
if (list != null && list.size() >= 1) {
    return list.get(0);
return null;
TgetFirstElement(List list)
This is a convenience method to return the first element from a list.
if (!isEmpty(list)) {
    return list.get(0);
return null;
TgetFirstElementFromList(List list)
get First Element From List
return list.size() > 0 ? list.get(0) : null;
TgetFirstFromList(List list)
Peaks first element from list
T value;
if (valid(list)) {
    value = list.get(FIRST_INDEX);
} else {
    value = null;
return value;