Java Collection First getFirst(Collection ts)

Here you can find the source of getFirst(Collection ts)

Description

get First

License

Open Source License

Declaration

private static <T> T getFirst(Collection<T> ts) 

Method Source Code

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

import java.util.Collection;
import java.util.Iterator;

public class Main {
    private static <T> T getFirst(Collection<T> ts) {
        final Iterator<T> it = ts.iterator();
        return it.hasNext() ? it.next() : null;
    }/*w  ww. j  a v a  2  s. c o  m*/
}

Related

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