Java List First Item first(List l)

Here you can find the source of first(List l)

Description

Get the first element from a list.

License

Open Source License

Parameter

Parameter Description
l the list the first element is to be extracted from.

Return

the first element of the passed in list.

Declaration

public static <T> T first(List<T> l) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    /**//from   ww  w. ja  v a  2  s .c  o m
     * Get the first element from a list.
     * 
     * @param l
     *            the list the first element is to be extracted from.
     * @return the first element of the passed in list.
     */
    public static <T> T first(List<T> l) {
        return l.get(0);
    }
}

Related

  1. extractFirst(int numberToExtract, List list)
  2. first(final List list)
  3. first(final List list, final int oridinal)
  4. first(final List t)
  5. first(List list)
  6. first(List l)
  7. first(List list)
  8. first(List list)
  9. first(List list)