Android examples for java.util:List Sub List
Get sub List Reverse
//package com.book2s; import java.util.List; import java.util.Vector; public class Main { public static void main(String[] argv) { List list = java.util.Arrays.asList("asdf", "book2s.com"); int fromIndex = 42; int toIndex = 42; System.out.println(subListReverse(list, fromIndex, toIndex)); }/*from w ww . j a va 2 s. c o m*/ /** * * @param <T> * @param list * @param fromIndex * @param toIndex * @return */ public static <T> List<T> subListReverse(List<T> list, int fromIndex, int toIndex) { List<T> subList = new Vector<T>(fromIndex - toIndex); for (int i = Math.min(fromIndex, list.size()) - 1; (i >= toIndex) && (i >= 0); i--) { T obj = list.get(i); subList.add(obj); } return subList; } }