Java Utililty Methods List Sub List

List of utility methods to do List Sub List

Description

The list of methods to do List Sub List are organized into topic(s).

Method

ListsubList(final List list, final int offset, final int amount)
Returns a List containing the elements of the given List from offset and only the given amount.
if (list == null) {
    return null;
if (offset >= list.size()) {
    return Collections.emptyList();
int toPos = offset + amount;
if (toPos >= list.size()) {
...
java.util.ListsubList(final List list, final int startIndex, final int endIndex)
sub List
if (null == list || list.isEmpty()) {
    return new ArrayList<T>();
int size = list.size();
int min = startIndex;
int max = endIndex == -1 ? size : size < endIndex ? size : endIndex;
if (max < min) {
    min = min ^ max;
...
ListsubList(final List source, final int... indices)
sub List
List<T> result = new ArrayList<T>(indices.length);
for (int index : indices) {
    result.add(source.get(index));
return result;
Listsublist(LinkedHashSet base, int start, int count)
sublist
Iterator<T> iterator = base.iterator();
int index = 0;
final List<T> result = new ArrayList<T>();
while (iterator.hasNext() && index < (start + count)) {
    T next = iterator.next();
    if (index < start) {
        index++;
        continue;
...
ListsubList(List list, int start, int end)
sub List
List temp = new ArrayList();
for (int i = start; i < end; i++) {
    temp.add(list.get(i));
return temp;
ListsubList(List list, int fromIndex, int toIndex)
sub List
return list.subList(fromIndex, toIndex);
ListsubList(List list, int page, int size)
sub List
return list.subList(Math.min(list.size(), (page - 1) * size), Math.min(list.size(), size * page));
ListsubList(List list, int fromIndex)
Returns a sub-list from a given position to the end.
return list.subList(fromIndex, list.size());
ListsubList(List list, int skip, int top)
Returns a subList.
if (top == 0 || skip >= list.size()) {
    return Collections.emptyList();
int lastIndex = skip + top;
if (lastIndex > list.size()) {
    lastIndex = list.size();
return list.subList(skip, lastIndex);
...
ListsubList(List list, int start, int end)
sub List
List<E> newList = new ArrayList<E>();
int normalizedSize = list.size() - 1;
if ((start < 0) || (start > normalizedSize) || (end < 0) || (start > end)) {
    return newList;
for (int i = start; (i < end) && (i <= normalizedSize); i++) {
    newList.add(list.get(i));
return newList;