From 8e1a287ed18f6390626141d5dbcc720ad9aa34f6 Mon Sep 17 00:00:00 2001 From: Redkale <22250530@qq.com> Date: Thu, 21 Dec 2017 17:33:18 +0800 Subject: [PATCH] --- src/org/redkale/util/Utility.java | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/org/redkale/util/Utility.java b/src/org/redkale/util/Utility.java index 03a210c26..b7563abb7 100644 --- a/src/org/redkale/util/Utility.java +++ b/src/org/redkale/util/Utility.java @@ -230,6 +230,40 @@ public final class Utility { return news; } + /** + * 将一个或多个int新元素添加到int数组结尾 + * + * @param array 原数组 + * @param objs 待追加数据 + * + * @return 新数组 + */ + public static int[] append(final int[] array, final int... objs) { + if (array == null || array.length == 0) return objs; + if (objs == null || objs.length == 0) return array; + final int[] news = new int[array.length + objs.length]; + System.arraycopy(array, 0, news, 0, array.length); + System.arraycopy(objs, 0, news, array.length, objs.length); + return news; + } + + /** + * 将一个或多个long新元素添加到long数组结尾 + * + * @param array 原数组 + * @param objs 待追加数据 + * + * @return 新数组 + */ + public static long[] append(final long[] array, final long... objs) { + if (array == null || array.length == 0) return objs; + if (objs == null || objs.length == 0) return array; + final long[] news = new long[array.length + objs.length]; + System.arraycopy(array, 0, news, 0, array.length); + System.arraycopy(objs, 0, news, array.length, objs.length); + return news; + } + /** * 将一个或多个新元素添加到数组结尾 *