Here you can find the source of toList(E[] array, int fromIndex, int toIndex)
Parameter | Description |
---|---|
array | the array to be converted into list |
fromIndex | the index of the first element, inclusive, to be sorted |
toIndex | the index of the last element, exclusive, to be sorted |
public static <E> List<E> toList(E[] array, int fromIndex, int toIndex)
//package com.java2s; //License from project: LGPL import java.util.Arrays; import java.util.List; public class Main { /**/*from w w w . java 2s . com*/ * * @param array the array to be converted into list * @param fromIndex the index of the first element, inclusive, to be sorted * @param toIndex the index of the last element, exclusive, to be sorted * @return */ public static <E> List<E> toList(E[] array, int fromIndex, int toIndex) { List<E> list = Arrays.asList(array); return list.subList(fromIndex, toIndex); } }