Class ArrayCopy

java.lang.Object
org.jdom2.internal.ArrayCopy

public final class ArrayCopy extends Object
The copyOf methods on java.util.Arrays are introduced in Java6. Need an alternative to support Java5.
Author:
Rolf Lear
  • Method Summary

    Modifier and Type
    Method
    Description
    static final boolean[]
    copyOf(boolean[] source, int len)
    Arrays.copyOf(...) is a Java6 thing.
    static final char[]
    copyOf(char[] source, int len)
    Arrays.copyOf(...) is a Java6 thing.
    static final int[]
    copyOf(int[] source, int len)
    Arrays.copyOf(...) is a Java6 thing.
    static final <E> E[]
    copyOf(E[] source, int len)
    Arrays.copyOf(...) is a Java6 thing.
    static final <E> E[]
    copyOfRange(E[] source, int from, int to)
    Arrays.copyOf(...) is a Java6 thing.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • copyOf

      public static final <E> E[] copyOf(E[] source, int len)
      Arrays.copyOf(...) is a Java6 thing. This is a replacement.
      Type Parameters:
      E - The generic type of the array we are copying.
      Parameters:
      source - the source array.
      len - the length of the new array copy.
      Returns:
      a new array that has the same elements as the source.
    • copyOfRange

      public static final <E> E[] copyOfRange(E[] source, int from, int to)
      Arrays.copyOf(...) is a Java6 thing. This is a replacement.
      Type Parameters:
      E - The generic type of the array we are copying.
      Parameters:
      source - the source array.
      from - the start point of the copy (inclusive).
      to - the end point of the copy (exclusive).
      Returns:
      a new array that has the same elements as the source.
    • copyOf

      public static final char[] copyOf(char[] source, int len)
      Arrays.copyOf(...) is a Java6 thing. This is a replacement.
      Parameters:
      source - the source array.
      len - the length of the new array copy.
      Returns:
      a new array that has the same elements as the source.
    • copyOf

      public static final int[] copyOf(int[] source, int len)
      Arrays.copyOf(...) is a Java6 thing. This is a replacement.
      Parameters:
      source - the source array.
      len - the length of the new array copy.
      Returns:
      a new array that has the same elements as the source.
    • copyOf

      public static final boolean[] copyOf(boolean[] source, int len)
      Arrays.copyOf(...) is a Java6 thing. This is a replacement.
      Parameters:
      source - the source array.
      len - the length of the new array copy.
      Returns:
      a new array that has the same elements as the source.