Java List First Item first(List list)

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

Description

first

License

Apache License

Declaration

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

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.List;

import java.util.NoSuchElementException;

public class Main {
    public static <T> T first(List<T> list) {
        if (list.size() < 1) {
            throw new NoSuchElementException("Collection does not have a enough elements");
        }//from   www. j a va2  s  .c o m
        return list.get(0);
    }
}

Related

  1. first(final List t)
  2. first(List list)
  3. first(List l)
  4. first(List l)
  5. first(List list)
  6. first(List list)
  7. first(List list)
  8. first(List list)
  9. first(List list)