Java Array Range Copy copyOf(char[] source)

Here you can find the source of copyOf(char[] source)

Description

copy Of

License

Open Source License

Declaration

public static char[] copyOf(char[] source) 

Method Source Code

//package com.java2s;
/*/*from   w  w w.java  2  s.c o  m*/
 * ====================================================================
 * Copyright (c) 2004-2012 TMate Software Ltd.  All rights reserved.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at http://svnkit.com/license.html
 * If newer versions of this license are posted there, you may use a
 * newer version instead, at your option.
 * ====================================================================
 */

public class Main {
    public static char[] copyOf(char[] source) {
        final char[] copy = source != null ? new char[source.length] : null;
        if (copy != null) {
            System.arraycopy(source, 0, copy, 0, source.length);
        }
        return copy;

    }
}

Related

  1. copyOf(byte[] original, int newLength)
  2. copyOf(byte[] original, int newLength)
  3. copyOf(byte[] source, int newLength)
  4. copyOf(byte[] src, int length)
  5. copyOf(char[] array)
  6. copyOf(double[] array, int length)
  7. copyOf(double[] v, int newlength)
  8. copyOf(final byte[] bytes)
  9. copyOf(int[] arr)