Here you can find the source of dump(T[] from, T[] to)
Parameter | Description |
---|---|
from | the data array to dump from. |
to | the data array to dump to. |
Parameter | Description |
---|---|
IllegalArgumentException | if the arrays are not equal in length. |
public static <T> void dump(T[] from, T[] to)
//package com.java2s; //License from project: Open Source License public class Main { /**/*w w w .j a v a2 s. c om*/ * Replaces all the data in {@code to} with {@code from} without making * modifications to the array being dumped. References are held to all of * the dumped Objects. * * @param from * the data array to dump from. * @param to * the data array to dump to. * @throws IllegalArgumentException * if the arrays are not equal in length. */ public static <T> void dump(T[] from, T[] to) { if (from.length != to.length) throw new IllegalArgumentException("Arrays must be equal in size!"); for (int i = 0; i < from.length; i++) to[i] = from[i]; } /** * Replaces all the data in {@code to} with {@code from} without making * modifications to the array being dumped. No references are held to the * dumped data since {@code int} is a primitive type. * * @param from * the data array to dump from. * @param to * the data array to dump to. * @throws IllegalArgumentException * if the arrays are not equal in length. */ public static void dump(int[] from, int[] to) { if (from.length != to.length) throw new IllegalArgumentException("Arrays must be equal in size!"); for (int i = 0; i < from.length; i++) to[i] = from[i]; } }