package com.qianwen.smartman.common.utils;
|
|
import java.util.List;
|
import com.qianwen.core.tool.utils.Func;
|
|
public final class ListUtils {
|
private ListUtils() {
|
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
|
}
|
|
public static <T> T getFirst(List<T> list) {
|
if (Func.isEmpty(list)) {
|
return null;
|
}
|
return list.get(0);
|
}
|
|
public static <T> T getLast(List<T> list) {
|
if (Func.isEmpty(list)) {
|
return null;
|
}
|
int size = list.size();
|
return list.get(size - 1);
|
}
|
}
|