Java Iterable First removeFirst(Iterable iterable)

Here you can find the source of removeFirst(Iterable iterable)

Description

remove First

License

Open Source License

Declaration

public static <T> T removeFirst(Iterable<T> iterable) 

Method Source Code

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

import java.util.Iterator;

public class Main {
    public static <T> T removeFirst(Iterable<T> iterable) {
        return removeNext(iterable.iterator());
    }/*from   w ww  .ja va2  s. co m*/

    public static <T> T removeNext(Iterator<T> iterator) {
        final T t = iterator.next();
        iterator.remove();
        return t;
    }
}

Related

  1. getFirst(Iterable iterable)
  2. getFirst(Iterable iterable, T defaultValue)
  3. getFirstElement(Object maybeIterable)
  4. getFirstOrNull(Iterable it)
  5. getFirstOrNull(Iterable iterable)