Here you can find the source of getFirstElementFromList(List
Parameter | Description |
---|---|
T | a parameter |
list | a parameter |
public static <T> T getFirstElementFromList(List<T> list)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { /**//from www.j a v a 2s .co m * * @param <T> * @param list * @return */ public static <T> T getFirstElementFromList(List<T> list) { return list.size() > 0 ? list.get(0) : null; } }