Java List First Item extractFirst(int numberToExtract, List list)

Here you can find the source of extractFirst(int numberToExtract, List list)

Description

extract First

License

Apache License

Declaration

public static <T extends Comparable<T>> List<T> extractFirst(int numberToExtract, List<T> list) 

Method Source Code

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

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static <T extends Comparable<T>> List<T> extractFirst(int numberToExtract, List<T> list) {
        List<T> topList = new ArrayList<T>();
        for (int i = 0; i < numberToExtract && i < list.size(); i++) {
            topList.add(list.get(i));/*from  w ww .  j a v a2 s .c o m*/
        }
        return topList;
    }
}

Related

  1. addFirst(List list, Object values)
  2. addFirstAndRemoveOldIfNeed(List dest, List src)
  3. cons(P first, List list)
  4. equalLists(List first, List second)
  5. expectedOrder(List src, Object first, Object second)
  6. first(final List list)
  7. first(final List list, final int oridinal)
  8. first(final List t)
  9. first(List list)

  10. HOME | Copyright © www.java2s.com 2016