Java tutorial
//package com.java2s; import java.util.List; public class Main { public static <T> T getFirst(List<T> list) { T t = null; if (list != null && !list.isEmpty()) { t = list.get(0); } return t; } }