Create a copy of the given array - or return null if the
argument is null.
178424
private static byte[] copy(byte[] from) {
    if (from != null) {
      byte[] to = new byte[from.length];
      System.arraycopy(from, 0, to, 0, to.length);
      return to;
    }
    return null;
  }
203789
public static double[][] array_clone(double[][] a) {
        if(a == null) {
            return a;
        }
        double[][] copy = new double[a.length][];
        for(int i=0;i<a.length;i++) {
            copy[i] = Arrays.copyOf(a[i], a[i].length);
        }
        return copy;
    }
738605
public static int[] copyOf(int[] old, int length) {
    int[] newArray = new int[length];
    int minLength = Math.min(old.length, length);
    System.arraycopy(old, 0, newArray, 0, minLength);
    return newArray;
  }
1087507
public static String fromNullTerminatedByteArray(byte[] array) {
        int stringSize = array.length;
        for (int i = 0; i < array.length; i++) {
            if (array[i] == 0) {
                stringSize = i;
                break;
            }
        }

        return new String(array, 0, stringSize);
    }
585183
function _clone(value) {
  if(value && typeof value === 'object') {
    var rval = Array.isArray(value) ? [] : {};
    for(var i in value) {
      rval[i] = _clone(value[i]);
    }
    return rval;
  }
  return value;
}
842331
public static int[] copyOf(int[] intArray) {

        int[] copy = new int[intArray.length];
        System.arraycopy(intArray, 0, copy, 0, intArray.length);
        return copy;
    }
29589
@SafeVarargs
    public static <V> V getLast(V... array) {
        return JMArrays.isNullOrEmpty(array) ? null : array[array.length - 1];
    }
893948
public ToStringBuilder append(final Object[] array) {
        style.append(buffer, null, array, null);
        return this;
    }
165091
void copyValue(int[] val) {
        int len = val.length;
        if (value.length < len)
            value = new int[len];
        System.arraycopy(val, 0, value, 0, len);
        intLen = len;
        offset = 0;
    }
1305397
@SuppressWarnings("unchecked")
    public static <T> T[] copyOf(T[] array, int length) {
        T[] newArray = (T[]) Array.newInstance(array.getClass().getComponentType(), length);
        System.arraycopy(array, 0, newArray, 0, Math.min(length, array.length));
        return newArray;
    }
1264424
@SuppressWarnings("unchecked")
    @Override
    public final <AT> AT[] toArray(AT[] a) {
        this.readLock.lock();
        try {
            // Verify the array size
            if (a.length < this.size) {
                a =
                        (AT[])
                                java.lang.reflect.Array.newInstance(
                                        a.getClass().getComponentType(), this.size);
            }

            // Trick to avoid generics warning
            final Object[] result = a;

            // Copy over all elements
            int index = 0;
            for (final Queue<T> queue : this.keyedQueues.values()) {
                for (final T e : queue) {
                    result[index++] = e;
                }
            }

            // If array is too big set next element null
            if (a.length > this.size) {
                a[this.size] = null;
            }

            return a;
        } finally {
            this.readLock.unlock();
        }
    }
1334802
private static String[] copyOf(String[] orig, int size) {
        final String[] copy = new String[size];
        System.arraycopy(orig, 0, copy, 0,
                Math.min(orig.length, size));
        return copy;
    }
1053936
public Object get (Object array, int index)
    {
        return (array == null) ? null : Array.get(array, index);
    }
1156675
static ArrayBlock createArrayBlockInternal(int arrayOffset, int positionCount, @Nullable boolean[] valueIsNull, int[] offsets, Block values)
    {
        validateConstructorArguments(arrayOffset, positionCount, valueIsNull, offsets, values);
        return new ArrayBlock(arrayOffset, positionCount, valueIsNull, offsets, values);
    }
373191
function clone(obj) {
  if (Array.isArray(obj)) {
    return obj.map((val) => clone(val))
  }
  if (isPlainObj(obj)) {
    return Object.keys(obj).reduce((copy, key) => {
      copy[key] = clone(obj[key])
      return copy
    }, {})
  }
  return obj
}
1152884
function createCache(array) {
    var index = -1,
        length = array.length;

    var cache = getObject();
    cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false;

    var result = getObject();
    result.array = array;
    result.cache = cache;
    result.push = cachePush;

    while (++index < length) {
      result.push(array[index]);
    }
    return cache.object === false
      ? (releaseObject(result), null)
      : result;
  }
189135
function copy(obj) {
  if (obj == null) {
    return obj;
  }

  if (array(obj)) {
    return obj.slice();
  } else if (plainObject(obj)) {
    return clone(obj);
  } else {
    return obj;
  }
}