Java tutorial
//package com.java2s; import java.util.Collections; import java.util.List; public class Main { public static <T> List<T> circleSubList(List<T> srcList, int position, int count) { if (srcList == null || srcList.size() == 0) { return Collections.emptyList(); } position = position < 0 ? 0 : position; count = count > srcList.size() ? srcList.size() : count; if (position > srcList.size() - 1) { return srcList.subList(0, count); } if (position + count <= srcList.size()) { return srcList.subList(position, (position + count)); } List<T> fList = srcList.subList(position, srcList.size()); List<T> eList = srcList.subList(0, count - srcList.size() + position); fList.addAll(eList); return fList; } }