Java Iterator firstOrDefault(Iterator iterator)

Here you can find the source of firstOrDefault(Iterator iterator)

Description

first Or Default

License

BSD License

Declaration

public static <T> T firstOrDefault(Iterator<T> iterator) 

Method Source Code

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

import java.util.Iterator;

public class Main {
    public static <T> T firstOrDefault(Iterator<T> iterator) {
        if (!iterator.hasNext()) {
            return null;
        }//  w ww.  j ava 2 s. co  m
        return iterator.next();
    }
}

Related

  1. equalsIterator(Iterator it, Iterator it2)
  2. fill(final Iterator iterator, final S collection)
  3. fillArray(Iterator ii, Object[] fillMe, boolean null_terminate)
  4. fillCollection(final Iterator iterator, final Collection collection)
  5. fillCollection(final Iterator iterator, final Collection collection)
  6. fmtSeq(Iterator it, String divider)
  7. fromIterator(Iterator iterator)
  8. fromIterator(Iterator iterator)
  9. fromIterator(Iterator itr)