Java List Tail tail(List lines, int number)

Here you can find the source of tail(List lines, int number)

Description

tail

License

Apache License

Declaration

public static List<String> tail(List<String> lines, int number) 

Method Source Code

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

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static List<String> tail(List<String> lines, int number) {
        List<String> result = new ArrayList<String>();
        int startpos = (lines.size() > number ? lines.size() - number : 0);
        if (lines.size() > number) {
            result.add("...(" + (lines.size() - number) + " lines skipped)...");
        }//from w w w  . java  2s  .c o m
        for (int i = startpos; i < lines.size(); i++) {
            result.add(lines.get(i));
        }
        return result;
    }
}

Related

  1. tail(final List list)
  2. tail(List list)
  3. tail(List list, int tailLength)
  4. tail(List lst, int from)
  5. tail(List l)
  6. tail(List list)
  7. tail(List list)