Java List First Item getFirstElementFromList(List list)

Here you can find the source of getFirstElementFromList(List list)

Description

get First Element From List

License

Apache License

Parameter

Parameter Description
T a parameter
list a parameter

Declaration

public static <T> T getFirstElementFromList(List<T> list) 

Method Source Code

//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;
    }
}

Related

  1. getFirstDuplicateValue(List values)
  2. getFirstElement(List list)
  3. getFirstElement(List collection)
  4. getFirstElement(List list)
  5. getFirstElement(List list)
  6. getFirstFromList(List list)
  7. getFirstInstanceOf(List source, String className)
  8. getFirstItemOrNull(List items)
  9. getFirstLeaf(List aList)