Java Array Sub Array subArray(T[] origin, int start, int length)

Here you can find the source of subArray(T[] origin, int start, int length)

Description

sub Array

License

Apache License

Declaration

public static <T> T[] subArray(T[] origin, int start, int length) 

Method Source Code


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

import java.util.Arrays;

import java.util.List;

public class Main {
    public static <T> T[] subArray(T[] origin, int start, int length) {
        return subList(origin, start, length).toArray(origin);
    }//from  www  .  j a  va  2  s  . co m

    public static <T> T[] subArray(T[] origin, int start) {
        return subList(origin, start).toArray(origin);
    }

    public static <T> List<T> subList(List<T> origin, int start, int length) {
        return origin.subList(start, start + length);
    }

    public static <T> List<T> subList(List<T> origin, int start) {
        return origin.subList(start, origin.size());
    }

    public static <T> List<T> subList(T[] origin, int start, int length) {
        return subList(Arrays.asList(origin), start, length);
    }

    public static <T> List<T> subList(T[] origin, int start) {
        return subList(Arrays.asList(origin), start);
    }
}

Related

  1. subArray(String[] strings, int nStart)
  2. subarray(T[] a, int off, int len)
  3. subArray(T[] array, int start, int end)
  4. subArray(T[] array, int start, int end)
  5. subArray(T[] array, int startIndex, int endIndex)
  6. subarrayChar2Double(char[] orig, int off, int len)
  7. subarrayEnd(byte[] array, int offset)
  8. subarrayEquals(int[] array, int[] subarray, int startIndex)
  9. subarrayOf(final String[] array, final int start, final int end)