Java List Tail tail(List list)

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

Description

Returns a sublist containing all the items in the list after the first

License

Open Source License

Parameter

Parameter Description
list a parameter

Declaration

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

Method Source Code

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

import java.util.Collection;
import java.util.Collections;

import java.util.List;

public class Main {
    /**/*from w  w w  .j  av  a 2  s.c  o  m*/
     * Returns a sublist containing all the items in the list after the first
     *
     * @param list
     *
     * @return
     */
    public static <T> List<T> tail(List<T> list) {
        if (list.isEmpty())
            return Collections.emptyList();
        else
            return list.subList(1, list.size());
    }

    public static <T> int size(final T[] items) {
        return items.length;
    }

    public static <T> int size(final Collection<T> items) {
        return items.size();
    }
}

Related

  1. tail(List lst, int from)
  2. tail(List l)
  3. tail(List list)
  4. tail(List list)
  5. tail(List list)