JDOM
0.0.5-BETA

org.jdom2.util
Class ArrayCopy

java.lang.Object
  extended by org.jdom2.util.ArrayCopy

public final class ArrayCopy
extends java.lang.Object

The copyOf methods on java.util.Arrays are introduced in Java6. Need an alternative to support Java5.

Author:
Rolf Lear

Method Summary
static boolean[] copyOf(boolean[] source, int len)
          Arrays.copyOf(...) is a Java6 thing.
static char[] copyOf(char[] source, int len)
          Arrays.copyOf(...) is a Java6 thing.
static
<E> E[]
copyOf(E[] source, int len)
          Arrays.copyOf(...) is a Java6 thing.
static int[] copyOf(int[] source, int len)
          Arrays.copyOf(...) is a Java6 thing.
static
<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 Detail

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.

JDOM
0.0.5-BETA

Copyright � 2012 Jason Hunter, Brett McLaughlin. All Rights Reserved.