Java List First Item first(final List list)

Here you can find the source of first(final List list)

Description

Gets the first element of the given list, or null if none.

License

Open Source License

Declaration

public static <T> T first(final List<T> list) 

Method Source Code


//package com.java2s;
import java.util.List;

public class Main {
    /** Gets the first element of the given list, or null if none. */
    public static <T> T first(final List<T> list) {
        if (list == null || list.size() == 0)
            return null;
        return list.get(0);
    }/*from ww w  .ja  v a  2 s. co m*/
}

Related

  1. addFirstAndRemoveOldIfNeed(List dest, List src)
  2. cons(P first, List list)
  3. equalLists(List first, List second)
  4. expectedOrder(List src, Object first, Object second)
  5. extractFirst(int numberToExtract, List list)
  6. first(final List list, final int oridinal)
  7. first(final List t)
  8. first(List list)
  9. first(List l)