Java Array Copy copyOf(boolean[] t)

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

Description

copy Of

License

Apache License

Declaration

public static boolean[] copyOf(boolean[] t) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static <T> T[] copyOf(T[] src, T[] dest) {
        List<T> l = new ArrayList<T>();
        for (int i = 0; i < src.length; i++) {
            T ti = src[i];/* w  ww .j av  a 2s .c  om*/
            l.add(ti);
        }
        return l.toArray(dest);
    }

    public static boolean[] copyOf(boolean[] t) {
        boolean[] out = new boolean[t.length];
        for (int i = 0; i < t.length; i++) {
            out[i] = t[i];
        }
        return out;
    }
}

Related

  1. copyArrayWhenNotNull(byte[] source)
  2. copyBytes(byte[] data, int from, int to)
  3. copyExcept(E[] orig, E excludedElem)
  4. copyIfExceeded(int[] arr, int len)
  5. copyIntoBigger(int[] array, int newSize, int defaultValue)
  6. copyOf(final U[] original, final int newLength, final Class newType)
  7. copyOf(T[] array)
  8. copyOf(T[] array, int count)
  9. copyOf(T[] original)