Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
Java15Compat.java
1 package org.bukkit.util;
2 
3 import java.lang.reflect.Array;
4 
5 public class Java15Compat {
6  @SuppressWarnings("unchecked")
7  public static <T> T[] Arrays_copyOfRange(T[] original, int start, int end) {
8  if (original.length >= start && 0 <= start) {
9  if (start <= end) {
10  int length = end - start;
11  int copyLength = Math.min(length, original.length - start);
12  T[] copy = (T[]) Array.newInstance(original.getClass().getComponentType(), length);
13 
14  System.arraycopy(original, start, copy, 0, copyLength);
15  return copy;
16  }
17  throw new IllegalArgumentException();
18  }
19  throw new ArrayIndexOutOfBoundsException();
20  }
21 }