Java Array Clone cloneArray(final String[] inputArray)

Here you can find the source of cloneArray(final String[] inputArray)

Description

To make the clone copy of the given String array.

License

Apache License

Parameter

Parameter Description
inputArray a parameter

Return

the cloned array of the given string array.

Declaration

public static String[] cloneArray(final String[] inputArray) 

Method Source Code

//package com.java2s;
/*/*from  w  ww  .  j av  a2 s. com*/
 * Copyright 2014-2016 Web Firm Framework
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

public class Main {
    /**
     * To make the clone copy of the given String array. This method is faster
     * than the clone method of String array.
     *
     * @param inputArray
     * @return the cloned array of the given string array.
     * @author WFF
     * @since 1.0.0
     */
    public static String[] cloneArray(final String[] inputArray) {
        final String[] array = new String[inputArray.length];
        System.arraycopy(inputArray, 0, array, 0, inputArray.length);
        return array;
    }
}

Related

  1. cloneArray(boolean[][] src)
  2. cloneArray(byte[] bytes)
  3. cloneArray(byte[] in)
  4. cloneArray(double[][] a)
  5. cloneArray(Double[][] src)
  6. cloneArray(int[] array)
  7. clonearray(int[] clonethis)
  8. cloneArray(int[] src)
  9. cloneArray(String[] orArray, int from)