Helius
2020-12-15 2914588a65371a3ce43f678cde0a26cd8da26611
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.matrix.system.hive.plugin.util;
 
/**
 * 操作数组的工具类
 * @author Ron
 * @createTime 2014.08.30
 */
public class ArrayUtils {
 
    /**
     * 增加元素到数组
     * 
     * @param objs
     * @param obj
     * @return
     */
    public static Object[] addElement(Object[] objs, Object obj) {
 
        if (objs == null) {
            return new Object[] { obj };
        }
        Object[] reObjs = new Object[objs.length + 1];
        System.arraycopy(objs, 0, reObjs, 0, objs.length);
        reObjs[objs.length] = obj;
        return objs;
    }
 
    /**
     * 增加元素到数组
     * 
     * @param objs
     * @param obj
     * @return
     */
    public static long[] addElement(long[] objs, long obj) {
 
        if (objs == null) {
            return new long[] { obj };
        }
        long[] reObjs = new long[objs.length + 1];
        System.arraycopy(objs, 0, reObjs, 0, objs.length);
        reObjs[objs.length] = obj;
        return objs;
    }
}