Java Collection First getFirst(final Collection collection)

Here you can find the source of getFirst(final Collection collection)

Description

get First

License

Apache License

Declaration

public static <T> T getFirst(final Collection<T> collection) 

Method Source Code


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

import java.util.Collection;

public class Main {
    public static <T> T getFirst(final Collection<T> collection) {

        return collection == null ? null : collection.iterator().next();
    }//from w ww  .ja va  2s  . co m
}

Related

  1. getFirst(Collection collection)
  2. getFirst(Collection l)
  3. getFirst(Collection set)
  4. getFirst(Collection set, boolean remove)
  5. getFirst(Collection ts)
  6. getFirstAndOnly(Collection c)
  7. getFirstClassOfType(Collection l, Class type)
  8. getFirstElement(Collection coll)
  9. getFirstElement(Collection collection, T defaultValue)