Here you can find the source of copy(final boolean[] array)
Parameter | Description |
---|---|
array | The array to copy. |
public static boolean[] copy(final boolean[] array)
//package com.java2s; /*/* ww w . ja v a2 s. c o m*/ * File: ArrayUtil.java * Authors: Justin Basilico * Company: Sandia National Laboratories * Project: Cognitive Foundry * * Copyright September 23, 2010, Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the U.S. Government. Export * of this program may require a license from the United States Government. * See CopyrightHistory.txt for complete details. * */ import java.util.Arrays; public class Main { /** * Creates a new copy of the given array. * * @param array * The array to copy. * @return * A copy of the given array. */ public static boolean[] copy(final boolean[] array) { if (array == null) { return null; } else { return Arrays.copyOf(array, array.length); } } /** * Creates a new copy of the given array. * * @param array * The array to copy. * @return * A copy of the given array. */ public static int[] copy(final int[] array) { if (array == null) { return null; } else { return Arrays.copyOf(array, array.length); } } /** * Creates a new copy of the given array. * * @param array * The array to copy. * @return * A copy of the given array. */ public static long[] copy(final long[] array) { if (array == null) { return null; } else { return Arrays.copyOf(array, array.length); } } /** * Creates a new copy of the given array. * * @param array * The array to copy. * @return * A copy of the given array. */ public static double[] copy(final double[] array) { if (array == null) { return null; } else { return Arrays.copyOf(array, array.length); } } /** * Creates a new copy of the given array. Does not copy the elements. * * @param <T> * The type of data in the array. * @param array * The array to copy. Does not copy the elements. * @return * A copy of the given array. */ public static <T> T[] copy(final T[] array) { if (array == null) { return null; } else { return Arrays.copyOf(array, array.length); } } }