Java Array Copy copy(long[] array)

Here you can find the source of copy(long[] array)

Description

copy

License

Open Source License

Declaration

private static long[] copy(long[] array) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2015, 2016 Raymond Aug? and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/*from   w ww  .  j a va  2s .  c om*/
 *     Raymond Aug? - bug fixes and enhancements
 ******************************************************************************/

import java.util.*;

public class Main {
    private static long[] copy(long[] array) {
        if (array == null) {
            return null;
        }
        if (array.length == 0) {
            return array;
        }
        return Arrays.copyOf(array, array.length);
    }

    private static String[] copy(String[] array) {
        if (array == null) {
            return null;
        }
        if (array.length == 0) {
            return array;
        }
        return Arrays.copyOf(array, array.length);
    }

    private static <T> T[] copy(T[] array) {
        if (array == null) {
            return null;
        }
        if (array.length == 0) {
            return array;
        }
        return Arrays.copyOf(array, array.length);
    }

    private static int copy(int value) {
        return value;
    }

    private static long copy(long value) {
        return value;
    }

    private static boolean copy(boolean value) {
        return value;
    }

    private static String copy(String value) {
        return value;
    }
}

Related

  1. copy(final byte[] bytes)
  2. copy(final byte[] inBytes)
  3. copy(int[] array)
  4. copy(int[] array)
  5. copy(int[][] input)
  6. copy(long[] v)
  7. copy(T[] array)
  8. copy(T[] array)
  9. copy2DArray(char[][] original)