从第一个数组中删除足够的字符串,以用最后一个对象开始填充第二个数组。
//package com.nowjava; //N o w J a v a . c o m public class Main { /** * Drops enough strings from the first array to fill the second one * beginning with the last object. * * @param from the array to take the object from * @param to the array to write the objects to * @throws IllegalArgumentException If the second array is not shorter than the first one. * * @author TheMrMilchmann * @since DerpieLang v1.0.0 */ public static final <T> T[] dropFromEnd(T[] from, T[] to) { if (from.length <= to.length) throw new IllegalArgumentException( "First array must be longer than the second one!");