首页

基于hutool工具包的ArrayUtil数组工具类非空判断、倒序&扩容等处理

标签:ArrayUtil,数组工具类,hutool-all     发布时间:2022-07-27   

一、前言

参考hutoolhutool-all包的cn.hutool.core.util.ArrayUtil数组工具类,对数组非空校验、获取数组第一个非空数据、数组扩展复制&追加、多数组合并及分割拆分等。

二、代码说明

package cn.hutool.core.util;@b@@b@import cn.hutool.core.collection.CollectionUtil;@b@import cn.hutool.core.collection.IterUtil;@b@import cn.hutool.core.exceptions.UtilException;@b@import cn.hutool.core.lang.Editor;@b@import cn.hutool.core.lang.Filter;@b@import java.lang.reflect.Array;@b@import java.nio.ByteBuffer;@b@import java.util.ArrayList;@b@import java.util.Arrays;@b@import java.util.Collection;@b@import java.util.Iterator;@b@import java.util.Map;@b@@b@public class ArrayUtil {@b@    public static final int INDEX_NOT_FOUND = -1;@b@@b@    public ArrayUtil() {@b@    }@b@@b@    public static <T> boolean isEmpty(T... array) {@b@        return array == null || array.length == 0;@b@    }@b@@b@    public static boolean isEmpty(Object array) {@b@        if (null == array) {@b@            return true;@b@        } else if (isArray(array)) {@b@            return 0 == Array.getLength(array);@b@        } else {@b@            throw new UtilException("Object to provide is not a Array !");@b@        }@b@    }@b@@b@    public static boolean isEmpty(long... array) {@b@        return array == null || array.length == 0;@b@    }@b@@b@    public static boolean isEmpty(int... array) {@b@        return array == null || array.length == 0;@b@    }@b@@b@    public static boolean isEmpty(short... array) {@b@        return array == null || array.length == 0;@b@    }@b@@b@    public static boolean isEmpty(char... array) {@b@        return array == null || array.length == 0;@b@    }@b@@b@    public static boolean isEmpty(byte... array) {@b@        return array == null || array.length == 0;@b@    }@b@@b@    public static boolean isEmpty(double... array) {@b@        return array == null || array.length == 0;@b@    }@b@@b@    public static boolean isEmpty(float... array) {@b@        return array == null || array.length == 0;@b@    }@b@@b@    public static boolean isEmpty(boolean... array) {@b@        return array == null || array.length == 0;@b@    }@b@@b@    public static <T> boolean isNotEmpty(T... array) {@b@        return array != null && array.length != 0;@b@    }@b@@b@    public static boolean isNotEmpty(Object array) {@b@        return !isEmpty(array);@b@    }@b@@b@    public static boolean isNotEmpty(long... array) {@b@        return array != null && array.length != 0;@b@    }@b@@b@    public static boolean isNotEmpty(int... array) {@b@        return array != null && array.length != 0;@b@    }@b@@b@    public static boolean isNotEmpty(short... array) {@b@        return array != null && array.length != 0;@b@    }@b@@b@    public static boolean isNotEmpty(char... array) {@b@        return array != null && array.length != 0;@b@    }@b@@b@    public static boolean isNotEmpty(byte... array) {@b@        return array != null && array.length != 0;@b@    }@b@@b@    public static boolean isNotEmpty(double... array) {@b@        return array != null && array.length != 0;@b@    }@b@@b@    public static boolean isNotEmpty(float... array) {@b@        return array != null && array.length != 0;@b@    }@b@@b@    public static boolean isNotEmpty(boolean... array) {@b@        return array != null && array.length != 0;@b@    }@b@@b@    public static <T> boolean hasNull(T... array) {@b@        if (isNotEmpty(array)) {@b@            Object[] arr$ = array;@b@            int len$ = array.length;@b@@b@            for(int i$ = 0; i$ < len$; ++i$) {@b@                T element = arr$[i$];@b@                if (null == element) {@b@                    return true;@b@                }@b@            }@b@        }@b@@b@        return false;@b@    }@b@@b@    public static <T> T firstNonNull(T... array) {@b@        if (isNotEmpty(array)) {@b@            Object[] arr$ = array;@b@            int len$ = array.length;@b@@b@            for(int i$ = 0; i$ < len$; ++i$) {@b@                T val = arr$[i$];@b@                if (null != val) {@b@                    return val;@b@                }@b@            }@b@        }@b@@b@        return null;@b@    }@b@@b@    public static <T> T[] newArray(Class<?> componentType, int newSize) {@b@        return (Object[])((Object[])Array.newInstance(componentType, newSize));@b@    }@b@@b@    public static Object[] newArray(int newSize) {@b@        return new Object[newSize];@b@    }@b@@b@    public static Class<?> getComponentType(Object array) {@b@        return null == array ? null : array.getClass().getComponentType();@b@    }@b@@b@    public static Class<?> getComponentType(Class<?> arrayClass) {@b@        return null == arrayClass ? null : arrayClass.getComponentType();@b@    }@b@@b@    public static Class<?> getArrayType(Class<?> componentType) {@b@        return Array.newInstance(componentType, 0).getClass();@b@    }@b@@b@    public static Object[] cast(Class<?> type, Object arrayObj) throws NullPointerException, IllegalArgumentException {@b@        if (null == arrayObj) {@b@            throw new NullPointerException("Argument [arrayObj] is null !");@b@        } else if (!arrayObj.getClass().isArray()) {@b@            throw new IllegalArgumentException("Argument [arrayObj] is not array !");@b@        } else if (null == type) {@b@            return (Object[])((Object[])arrayObj);@b@        } else {@b@            Class<?> componentType = type.isArray() ? type.getComponentType() : type;@b@            Object[] array = (Object[])((Object[])arrayObj);@b@            Object[] result = newArray(componentType, array.length);@b@            System.arraycopy(array, 0, result, 0, array.length);@b@            return result;@b@        }@b@    }@b@@b@    @SafeVarargs@b@    public static <T> T[] append(T[] buffer, T... newElements) {@b@        return isEmpty(buffer) ? newElements : insert(buffer, buffer.length, newElements);@b@    }@b@@b@    @SafeVarargs@b@    public static <T> Object append(Object array, T... newElements) {@b@        return isEmpty(array) ? newElements : insert(array, length(array), newElements);@b@    }@b@@b@    public static <T> T[] setOrAppend(T[] buffer, int index, T value) {@b@        if (index < buffer.length) {@b@            Array.set(buffer, index, value);@b@            return buffer;@b@        } else {@b@            return append(buffer, value);@b@        }@b@    }@b@@b@    public static Object setOrAppend(Object array, int index, Object value) {@b@        if (index < length(array)) {@b@            Array.set(array, index, value);@b@            return array;@b@        } else {@b@            return append(array, value);@b@        }@b@    }@b@@b@    public static <T> T[] insert(T[] buffer, int index, T... newElements) {@b@        return (Object[])((Object[])insert((Object)buffer, index, newElements));@b@    }@b@@b@    public static <T> Object insert(Object array, int index, T... newElements) {@b@        if (isEmpty(newElements)) {@b@            return array;@b@        } else if (isEmpty(array)) {@b@            return newElements;@b@        } else {@b@            int len = length(array);@b@            if (index < 0) {@b@                index = index % len + len;@b@            }@b@@b@            T[] result = newArray(array.getClass().getComponentType(), Math.max(len, index) + newElements.length);@b@            System.arraycopy(array, 0, result, 0, Math.min(len, index));@b@            System.arraycopy(newElements, 0, result, index, newElements.length);@b@            if (index < len) {@b@                System.arraycopy(array, index, result, index + newElements.length, len - index);@b@            }@b@@b@            return result;@b@        }@b@    }@b@@b@    public static <T> T[] resize(T[] buffer, int newSize, Class<?> componentType) {@b@        T[] newArray = newArray(componentType, newSize);@b@        if (isNotEmpty(buffer)) {@b@            System.arraycopy(buffer, 0, newArray, 0, Math.min(buffer.length, newSize));@b@        }@b@@b@        return newArray;@b@    }@b@@b@    public static <T> T[] resize(T[] buffer, int newSize) {@b@        return resize(buffer, newSize, buffer.getClass().getComponentType());@b@    }@b@@b@    @SafeVarargs@b@    public static <T> T[] addAll(T[]... arrays) {@b@        if (arrays.length == 1) {@b@            return arrays[0];@b@        } else {@b@            int length = 0;@b@            Object[][] arr$ = arrays;@b@            int len$ = arrays.length;@b@@b@            int len$;@b@            for(len$ = 0; len$ < len$; ++len$) {@b@                T[] array = arr$[len$];@b@                if (array != null) {@b@                    length += array.length;@b@                }@b@            }@b@@b@            T[] result = newArray(arrays.getClass().getComponentType().getComponentType(), length);@b@            length = 0;@b@            Object[][] arr$ = arrays;@b@            len$ = arrays.length;@b@@b@            for(int i$ = 0; i$ < len$; ++i$) {@b@                T[] array = arr$[i$];@b@                if (array != null) {@b@                    System.arraycopy(array, 0, result, length, array.length);@b@                    length += array.length;@b@                }@b@            }@b@@b@            return result;@b@        }@b@    }@b@@b@    public static Object copy(Object src, int srcPos, Object dest, int destPos, int length) {@b@        System.arraycopy(src, srcPos, dest, destPos, length);@b@        return dest;@b@    }@b@@b@    public static Object copy(Object src, Object dest, int length) {@b@        System.arraycopy(src, 0, dest, 0, length);@b@        return dest;@b@    }@b@@b@    public static <T> T[] clone(T[] array) {@b@        return array == null ? null : (Object[])array.clone();@b@    }@b@@b@    public static <T> T clone(T obj) {@b@        if (null == obj) {@b@            return null;@b@        } else if (!isArray(obj)) {@b@            return null;@b@        } else {@b@            Class<?> componentType = obj.getClass().getComponentType();@b@            Object result;@b@            if (componentType.isPrimitive()) {@b@                int length = Array.getLength(obj);@b@                result = Array.newInstance(componentType, length);@b@@b@                while(length-- > 0) {@b@                    Array.set(result, length, Array.get(obj, length));@b@                }@b@            } else {@b@                result = ((Object[])((Object[])obj)).clone();@b@            }@b@@b@            return result;@b@        }@b@    }@b@@b@    public static int[] range(int excludedEnd) {@b@        return range(0, excludedEnd, 1);@b@    }@b@@b@    public static int[] range(int includedStart, int excludedEnd) {@b@        return range(includedStart, excludedEnd, 1);@b@    }@b@@b@    public static int[] range(int includedStart, int excludedEnd, int step) {@b@        int deviation;@b@        if (includedStart > excludedEnd) {@b@            deviation = includedStart;@b@            includedStart = excludedEnd;@b@            excludedEnd = deviation;@b@        }@b@@b@        if (step <= 0) {@b@            step = 1;@b@        }@b@@b@        deviation = excludedEnd - includedStart;@b@        int length = deviation / step;@b@        if (deviation % step != 0) {@b@            ++length;@b@        }@b@@b@        int[] range = new int[length];@b@@b@        for(int i = 0; i < length; ++i) {@b@            range[i] = includedStart;@b@            includedStart += step;@b@        }@b@@b@        return range;@b@    }@b@@b@    public static byte[][] split(byte[] array, int len) {@b@        int x = array.length / len;@b@        int y = array.length % len;@b@        int z = 0;@b@        if (y != 0) {@b@            z = 1;@b@        }@b@@b@        byte[][] arrays = new byte[x + z][];@b@@b@        for(int i = 0; i < x + z; ++i) {@b@            byte[] arr = new byte[len];@b@            if (i == x + z - 1 && y != 0) {@b@                System.arraycopy(array, i * len, arr, 0, y);@b@            } else {@b@                System.arraycopy(array, i * len, arr, 0, len);@b@            }@b@@b@            arrays[i] = arr;@b@        }@b@@b@        return arrays;@b@    }@b@@b@    public static <T> T[] filter(T[] array, Editor<T> editor) {@b@        ArrayList<T> list = new ArrayList(array.length);@b@        Object[] arr$ = array;@b@        int len$ = array.length;@b@@b@        for(int i$ = 0; i$ < len$; ++i$) {@b@            T t = arr$[i$];@b@            T modified = editor.edit(t);@b@            if (null != modified) {@b@                list.add(modified);@b@            }@b@        }@b@@b@        return list.toArray(Arrays.copyOf(array, list.size()));@b@    }@b@@b@    public static <T> T[] filter(T[] array, Filter<T> filter) {@b@        if (null == filter) {@b@            return array;@b@        } else {@b@            ArrayList<T> list = new ArrayList(array.length);@b@            Object[] result = array;@b@            int len$ = array.length;@b@@b@            for(int i$ = 0; i$ < len$; ++i$) {@b@                T t = result[i$];@b@                if (filter.accept(t)) {@b@                    list.add(t);@b@                }@b@            }@b@@b@            result = newArray(array.getClass().getComponentType(), list.size());@b@            return list.toArray(result);@b@        }@b@    }@b@@b@    public static <T> T[] removeNull(T[] array) {@b@        return filter(array, new Editor<T>() {@b@            public T edit(T t) {@b@                return t;@b@            }@b@        });@b@    }@b@@b@    public static <T extends CharSequence> T[] removeEmpty(T[] array) {@b@        return (CharSequence[])filter(array, (Filter)(new Filter<T>() {@b@            public boolean accept(T t) {@b@                return !StrUtil.isEmpty(t);@b@            }@b@        }));@b@    }@b@@b@    public static <T extends CharSequence> T[] removeBlank(T[] array) {@b@        return (CharSequence[])filter(array, (Filter)(new Filter<T>() {@b@            public boolean accept(T t) {@b@                return !StrUtil.isBlank(t);@b@            }@b@        }));@b@    }@b@@b@    public static String[] nullToEmpty(String[] array) {@b@        return (String[])filter(array, (Editor)(new Editor<String>() {@b@            public String edit(String t) {@b@                return null == t ? "" : t;@b@            }@b@        }));@b@    }@b@@b@    public static <K, V> Map<K, V> zip(K[] keys, V[] values, boolean isOrder) {@b@        if (!isEmpty(keys) && !isEmpty(values)) {@b@            int size = Math.min(keys.length, values.length);@b@            Map<K, V> map = CollectionUtil.newHashMap(size, isOrder);@b@@b@            for(int i = 0; i < size; ++i) {@b@                map.put(keys[i], values[i]);@b@            }@b@@b@            return map;@b@        } else {@b@            return null;@b@        }@b@    }@b@@b@    public static <K, V> Map<K, V> zip(K[] keys, V[] values) {@b@        return zip(keys, values, false);@b@    }@b@@b@    public static <T> int indexOf(T[] array, Object value) {@b@        if (null != array) {@b@            for(int i = 0; i < array.length; ++i) {@b@                if (ObjectUtil.equal(value, array[i])) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static int indexOfIgnoreCase(CharSequence[] array, CharSequence value) {@b@        if (null != array) {@b@            for(int i = 0; i < array.length; ++i) {@b@                if (StrUtil.equalsIgnoreCase(array[i], value)) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static <T> int lastIndexOf(T[] array, Object value) {@b@        if (null != array) {@b@            for(int i = array.length - 1; i >= 0; --i) {@b@                if (ObjectUtil.equal(value, array[i])) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static <T> boolean contains(T[] array, T value) {@b@        return indexOf(array, value) > -1;@b@    }@b@@b@    public static <T> boolean containsAny(T[] array, T... values) {@b@        Object[] arr$ = values;@b@        int len$ = values.length;@b@@b@        for(int i$ = 0; i$ < len$; ++i$) {@b@            T value = arr$[i$];@b@            if (contains(array, value)) {@b@                return true;@b@            }@b@        }@b@@b@        return false;@b@    }@b@@b@    public static boolean containsIgnoreCase(CharSequence[] array, CharSequence value) {@b@        return indexOfIgnoreCase(array, value) > -1;@b@    }@b@@b@    public static int indexOf(long[] array, long value) {@b@        if (null != array) {@b@            for(int i = 0; i < array.length; ++i) {@b@                if (value == array[i]) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static int lastIndexOf(long[] array, long value) {@b@        if (null != array) {@b@            for(int i = array.length - 1; i >= 0; --i) {@b@                if (value == array[i]) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static boolean contains(long[] array, long value) {@b@        return indexOf(array, value) > -1;@b@    }@b@@b@    public static int indexOf(int[] array, int value) {@b@        if (null != array) {@b@            for(int i = 0; i < array.length; ++i) {@b@                if (value == array[i]) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static int lastIndexOf(int[] array, int value) {@b@        if (null != array) {@b@            for(int i = array.length - 1; i >= 0; --i) {@b@                if (value == array[i]) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static boolean contains(int[] array, int value) {@b@        return indexOf(array, value) > -1;@b@    }@b@@b@    public static int indexOf(short[] array, short value) {@b@        if (null != array) {@b@            for(int i = 0; i < array.length; ++i) {@b@                if (value == array[i]) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static int lastIndexOf(short[] array, short value) {@b@        if (null != array) {@b@            for(int i = array.length - 1; i >= 0; --i) {@b@                if (value == array[i]) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static boolean contains(short[] array, short value) {@b@        return indexOf(array, value) > -1;@b@    }@b@@b@    public static int indexOf(char[] array, char value) {@b@        if (null != array) {@b@            for(int i = 0; i < array.length; ++i) {@b@                if (value == array[i]) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static int lastIndexOf(char[] array, char value) {@b@        if (null != array) {@b@            for(int i = array.length - 1; i >= 0; --i) {@b@                if (value == array[i]) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static boolean contains(char[] array, char value) {@b@        return indexOf(array, value) > -1;@b@    }@b@@b@    public static int indexOf(byte[] array, byte value) {@b@        if (null != array) {@b@            for(int i = 0; i < array.length; ++i) {@b@                if (value == array[i]) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static int lastIndexOf(byte[] array, byte value) {@b@        if (null != array) {@b@            for(int i = array.length - 1; i >= 0; --i) {@b@                if (value == array[i]) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static boolean contains(byte[] array, byte value) {@b@        return indexOf(array, value) > -1;@b@    }@b@@b@    public static int indexOf(double[] array, double value) {@b@        if (null != array) {@b@            for(int i = 0; i < array.length; ++i) {@b@                if (value == array[i]) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static int lastIndexOf(double[] array, double value) {@b@        if (null != array) {@b@            for(int i = array.length - 1; i >= 0; --i) {@b@                if (value == array[i]) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static boolean contains(double[] array, double value) {@b@        return indexOf(array, value) > -1;@b@    }@b@@b@    public static int indexOf(float[] array, float value) {@b@        if (null != array) {@b@            for(int i = 0; i < array.length; ++i) {@b@                if (value == array[i]) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static int lastIndexOf(float[] array, float value) {@b@        if (null != array) {@b@            for(int i = array.length - 1; i >= 0; --i) {@b@                if (value == array[i]) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static boolean contains(float[] array, float value) {@b@        return indexOf(array, value) > -1;@b@    }@b@@b@    public static int indexOf(boolean[] array, boolean value) {@b@        if (null != array) {@b@            for(int i = 0; i < array.length; ++i) {@b@                if (value == array[i]) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static int lastIndexOf(boolean[] array, boolean value) {@b@        if (null != array) {@b@            for(int i = array.length - 1; i >= 0; --i) {@b@                if (value == array[i]) {@b@                    return i;@b@                }@b@            }@b@        }@b@@b@        return -1;@b@    }@b@@b@    public static boolean contains(boolean[] array, boolean value) {@b@        return indexOf(array, value) > -1;@b@    }@b@@b@    public static Integer[] wrap(int... values) {@b@        if (null == values) {@b@            return null;@b@        } else {@b@            int length = values.length;@b@            if (0 == length) {@b@                return new Integer[0];@b@            } else {@b@                Integer[] array = new Integer[length];@b@@b@                for(int i = 0; i < length; ++i) {@b@                    array[i] = values[i];@b@                }@b@@b@                return array;@b@            }@b@        }@b@    }@b@@b@    public static int[] unWrap(Integer... values) {@b@        if (null == values) {@b@            return null;@b@        } else {@b@            int length = values.length;@b@            if (0 == length) {@b@                return new int[0];@b@            } else {@b@                int[] array = new int[length];@b@@b@                for(int i = 0; i < length; ++i) {@b@                    array[i] = values[i];@b@                }@b@@b@                return array;@b@            }@b@        }@b@    }@b@@b@    public static Long[] wrap(long... values) {@b@        if (null == values) {@b@            return null;@b@        } else {@b@            int length = values.length;@b@            if (0 == length) {@b@                return new Long[0];@b@            } else {@b@                Long[] array = new Long[length];@b@@b@                for(int i = 0; i < length; ++i) {@b@                    array[i] = values[i];@b@                }@b@@b@                return array;@b@            }@b@        }@b@    }@b@@b@    public static long[] unWrap(Long... values) {@b@        if (null == values) {@b@            return null;@b@        } else {@b@            int length = values.length;@b@            if (0 == length) {@b@                return new long[0];@b@            } else {@b@                long[] array = new long[length];@b@@b@                for(int i = 0; i < length; ++i) {@b@                    array[i] = values[i];@b@                }@b@@b@                return array;@b@            }@b@        }@b@    }@b@@b@    public static Character[] wrap(char... values) {@b@        if (null == values) {@b@            return null;@b@        } else {@b@            int length = values.length;@b@            if (0 == length) {@b@                return new Character[0];@b@            } else {@b@                Character[] array = new Character[length];@b@@b@                for(int i = 0; i < length; ++i) {@b@                    array[i] = values[i];@b@                }@b@@b@                return array;@b@            }@b@        }@b@    }@b@@b@    public static char[] unWrap(Character... values) {@b@        if (null == values) {@b@            return null;@b@        } else {@b@            int length = values.length;@b@            if (0 == length) {@b@                return new char[0];@b@            } else {@b@                char[] array = new char[length];@b@@b@                for(int i = 0; i < length; ++i) {@b@                    array[i] = values[i];@b@                }@b@@b@                return array;@b@            }@b@        }@b@    }@b@@b@    public static Byte[] wrap(byte... values) {@b@        if (null == values) {@b@            return null;@b@        } else {@b@            int length = values.length;@b@            if (0 == length) {@b@                return new Byte[0];@b@            } else {@b@                Byte[] array = new Byte[length];@b@@b@                for(int i = 0; i < length; ++i) {@b@                    array[i] = values[i];@b@                }@b@@b@                return array;@b@            }@b@        }@b@    }@b@@b@    public static byte[] unWrap(Byte... values) {@b@        if (null == values) {@b@            return null;@b@        } else {@b@            int length = values.length;@b@            if (0 == length) {@b@                return new byte[0];@b@            } else {@b@                byte[] array = new byte[length];@b@@b@                for(int i = 0; i < length; ++i) {@b@                    array[i] = values[i];@b@                }@b@@b@                return array;@b@            }@b@        }@b@    }@b@@b@    public static Short[] wrap(short... values) {@b@        if (null == values) {@b@            return null;@b@        } else {@b@            int length = values.length;@b@            if (0 == length) {@b@                return new Short[0];@b@            } else {@b@                Short[] array = new Short[length];@b@@b@                for(int i = 0; i < length; ++i) {@b@                    array[i] = values[i];@b@                }@b@@b@                return array;@b@            }@b@        }@b@    }@b@@b@    public static short[] unWrap(Short... values) {@b@        if (null == values) {@b@            return null;@b@        } else {@b@            int length = values.length;@b@            if (0 == length) {@b@                return new short[0];@b@            } else {@b@                short[] array = new short[length];@b@@b@                for(int i = 0; i < length; ++i) {@b@                    array[i] = values[i];@b@                }@b@@b@                return array;@b@            }@b@        }@b@    }@b@@b@    public static Float[] wrap(float... values) {@b@        if (null == values) {@b@            return null;@b@        } else {@b@            int length = values.length;@b@            if (0 == length) {@b@                return new Float[0];@b@            } else {@b@                Float[] array = new Float[length];@b@@b@                for(int i = 0; i < length; ++i) {@b@                    array[i] = values[i];@b@                }@b@@b@                return array;@b@            }@b@        }@b@    }@b@@b@    public static float[] unWrap(Float... values) {@b@        if (null == values) {@b@            return null;@b@        } else {@b@            int length = values.length;@b@            if (0 == length) {@b@                return new float[0];@b@            } else {@b@                float[] array = new float[length];@b@@b@                for(int i = 0; i < length; ++i) {@b@                    array[i] = values[i];@b@                }@b@@b@                return array;@b@            }@b@        }@b@    }@b@@b@    public static Double[] wrap(double... values) {@b@        if (null == values) {@b@            return null;@b@        } else {@b@            int length = values.length;@b@            if (0 == length) {@b@                return new Double[0];@b@            } else {@b@                Double[] array = new Double[length];@b@@b@                for(int i = 0; i < length; ++i) {@b@                    array[i] = values[i];@b@                }@b@@b@                return array;@b@            }@b@        }@b@    }@b@@b@    public static double[] unWrap(Double... values) {@b@        if (null == values) {@b@            return null;@b@        } else {@b@            int length = values.length;@b@            if (0 == length) {@b@                return new double[0];@b@            } else {@b@                double[] array = new double[length];@b@@b@                for(int i = 0; i < length; ++i) {@b@                    array[i] = values[i];@b@                }@b@@b@                return array;@b@            }@b@        }@b@    }@b@@b@    public static Boolean[] wrap(boolean... values) {@b@        if (null == values) {@b@            return null;@b@        } else {@b@            int length = values.length;@b@            if (0 == length) {@b@                return new Boolean[0];@b@            } else {@b@                Boolean[] array = new Boolean[length];@b@@b@                for(int i = 0; i < length; ++i) {@b@                    array[i] = values[i];@b@                }@b@@b@                return array;@b@            }@b@        }@b@    }@b@@b@    public static boolean[] unWrap(Boolean... values) {@b@        if (null == values) {@b@            return null;@b@        } else {@b@            int length = values.length;@b@            if (0 == length) {@b@                return new boolean[0];@b@            } else {@b@                boolean[] array = new boolean[length];@b@@b@                for(int i = 0; i < length; ++i) {@b@                    array[i] = values[i];@b@                }@b@@b@                return array;@b@            }@b@        }@b@    }@b@@b@    public static Object[] wrap(Object obj) {@b@        if (null == obj) {@b@            return null;@b@        } else if (isArray(obj)) {@b@            try {@b@                return (Object[])((Object[])obj);@b@            } catch (Exception var5) {@b@                String className = obj.getClass().getComponentType().getName();@b@                byte var4 = -1;@b@                switch(className.hashCode()) {@b@                case -1325958191:@b@                    if (className.equals("double")) {@b@                        var4 = 7;@b@                    }@b@                    break;@b@                case 104431:@b@                    if (className.equals("int")) {@b@                        var4 = 1;@b@                    }@b@                    break;@b@                case 3039496:@b@                    if (className.equals("byte")) {@b@                        var4 = 4;@b@                    }@b@                    break;@b@                case 3052374:@b@                    if (className.equals("char")) {@b@                        var4 = 3;@b@                    }@b@                    break;@b@                case 3327612:@b@                    if (className.equals("long")) {@b@                        var4 = 0;@b@                    }@b@                    break;@b@                case 64711720:@b@                    if (className.equals("boolean")) {@b@                        var4 = 5;@b@                    }@b@                    break;@b@                case 97526364:@b@                    if (className.equals("float")) {@b@                        var4 = 6;@b@                    }@b@                    break;@b@                case 109413500:@b@                    if (className.equals("short")) {@b@                        var4 = 2;@b@                    }@b@                }@b@@b@                switch(var4) {@b@                case 0:@b@                    return wrap((long[])((long[])obj));@b@                case 1:@b@                    return wrap((int[])((int[])obj));@b@                case 2:@b@                    return wrap((short[])((short[])obj));@b@                case 3:@b@                    return wrap((char[])((char[])obj));@b@                case 4:@b@                    return wrap((byte[])((byte[])obj));@b@                case 5:@b@                    return wrap((boolean[])((boolean[])obj));@b@                case 6:@b@                    return wrap((float[])((float[])obj));@b@                case 7:@b@                    return wrap((double[])((double[])obj));@b@                default:@b@                    throw new UtilException(var5);@b@                }@b@            }@b@        } else {@b@            throw new UtilException(StrUtil.format("[{}] is not Array!", new Object[]{obj.getClass()}));@b@        }@b@    }@b@@b@    public static boolean isArray(Object obj) {@b@        return null == obj ? false : obj.getClass().isArray();@b@    }@b@@b@    public static <T> T get(Object array, int index) {@b@        if (null == array) {@b@            return null;@b@        } else {@b@            if (index < 0) {@b@                index += Array.getLength(array);@b@            }@b@@b@            try {@b@                return Array.get(array, index);@b@            } catch (ArrayIndexOutOfBoundsException var3) {@b@                return null;@b@            }@b@        }@b@    }@b@@b@    public static <T> T[] getAny(Object array, int... indexes) {@b@        if (null == array) {@b@            return null;@b@        } else {@b@            T[] result = newArray(array.getClass().getComponentType(), indexes.length);@b@            int[] arr$ = indexes;@b@            int len$ = indexes.length;@b@@b@            for(int i$ = 0; i$ < len$; ++i$) {@b@                int i = arr$[i$];@b@                result[i] = get(array, i);@b@            }@b@@b@            return result;@b@        }@b@    }@b@@b@    public static <T> T[] sub(T[] array, int start, int end) {@b@        int length = length(array);@b@        if (start < 0) {@b@            start += length;@b@        }@b@@b@        if (end < 0) {@b@            end += length;@b@        }@b@@b@        if (start == length) {@b@            return newArray(array.getClass().getComponentType(), 0);@b@        } else {@b@            if (start > end) {@b@                int tmp = start;@b@                start = end;@b@                end = tmp;@b@            }@b@@b@            if (end > length) {@b@                if (start >= length) {@b@                    return newArray(array.getClass().getComponentType(), 0);@b@                }@b@@b@                end = length;@b@            }@b@@b@            return Arrays.copyOfRange(array, start, end);@b@        }@b@    }@b@@b@    public static Object[] sub(Object array, int start, int end) {@b@        return sub(array, start, end, 1);@b@    }@b@@b@    public static Object[] sub(Object array, int start, int end, int step) {@b@        int length = length(array);@b@        if (start < 0) {@b@            start += length;@b@        }@b@@b@        if (end < 0) {@b@            end += length;@b@        }@b@@b@        if (start == length) {@b@            return new Object[0];@b@        } else {@b@            if (start > end) {@b@                int tmp = start;@b@                start = end;@b@                end = tmp;@b@            }@b@@b@            if (end > length) {@b@                if (start >= length) {@b@                    return new Object[0];@b@                }@b@@b@                end = length;@b@            }@b@@b@            if (step <= 1) {@b@                step = 1;@b@            }@b@@b@            ArrayList<Object> list = new ArrayList();@b@@b@            for(int i = start; i < end; i += step) {@b@                list.add(get(array, i));@b@            }@b@@b@            return list.toArray();@b@        }@b@    }@b@@b@    public static String toString(Object obj) {@b@        if (null == obj) {@b@            return null;@b@        } else if (isArray(obj)) {@b@            try {@b@                return Arrays.deepToString((Object[])((Object[])obj));@b@            } catch (Exception var5) {@b@                String className = obj.getClass().getComponentType().getName();@b@                byte var4 = -1;@b@                switch(className.hashCode()) {@b@                case -1325958191:@b@                    if (className.equals("double")) {@b@                        var4 = 7;@b@                    }@b@                    break;@b@                case 104431:@b@                    if (className.equals("int")) {@b@                        var4 = 1;@b@                    }@b@                    break;@b@                case 3039496:@b@                    if (className.equals("byte")) {@b@                        var4 = 4;@b@                    }@b@                    break;@b@                case 3052374:@b@                    if (className.equals("char")) {@b@                        var4 = 3;@b@                    }@b@                    break;@b@                case 3327612:@b@                    if (className.equals("long")) {@b@                        var4 = 0;@b@                    }@b@                    break;@b@                case 64711720:@b@                    if (className.equals("boolean")) {@b@                        var4 = 5;@b@                    }@b@                    break;@b@                case 97526364:@b@                    if (className.equals("float")) {@b@                        var4 = 6;@b@                    }@b@                    break;@b@                case 109413500:@b@                    if (className.equals("short")) {@b@                        var4 = 2;@b@                    }@b@                }@b@@b@                switch(var4) {@b@                case 0:@b@                    return Arrays.toString((long[])((long[])obj));@b@                case 1:@b@                    return Arrays.toString((int[])((int[])obj));@b@                case 2:@b@                    return Arrays.toString((short[])((short[])obj));@b@                case 3:@b@                    return Arrays.toString((char[])((char[])obj));@b@                case 4:@b@                    return Arrays.toString((byte[])((byte[])obj));@b@                case 5:@b@                    return Arrays.toString((boolean[])((boolean[])obj));@b@                case 6:@b@                    return Arrays.toString((float[])((float[])obj));@b@                case 7:@b@                    return Arrays.toString((double[])((double[])obj));@b@                default:@b@                    throw new UtilException(var5);@b@                }@b@            }@b@        } else {@b@            return obj.toString();@b@        }@b@    }@b@@b@    public static int length(Object array) throws IllegalArgumentException {@b@        return null == array ? 0 : Array.getLength(array);@b@    }@b@@b@    public static <T> String join(T[] array, CharSequence conjunction) {@b@        return join(array, conjunction, (String)null, (String)null);@b@    }@b@@b@    public static <T> String join(T[] array, CharSequence conjunction, String prefix, String suffix) {@b@        if (null == array) {@b@            return null;@b@        } else {@b@            StringBuilder sb = new StringBuilder();@b@            boolean isFirst = true;@b@            Object[] arr$ = array;@b@            int len$ = array.length;@b@@b@            for(int i$ = 0; i$ < len$; ++i$) {@b@                T item = arr$[i$];@b@                if (isFirst) {@b@                    isFirst = false;@b@                } else {@b@                    sb.append(conjunction);@b@                }@b@@b@                if (isArray(item)) {@b@                    sb.append(join(wrap(item), conjunction, prefix, suffix));@b@                } else if (item instanceof Iterable) {@b@                    sb.append(IterUtil.join((Iterable)item, conjunction, prefix, suffix));@b@                } else if (item instanceof Iterator) {@b@                    sb.append(IterUtil.join((Iterator)item, conjunction, prefix, suffix));@b@                } else {@b@                    sb.append(StrUtil.wrap(StrUtil.toString(item), prefix, suffix));@b@                }@b@            }@b@@b@            return sb.toString();@b@        }@b@    }@b@@b@    public static String join(long[] array, CharSequence conjunction) {@b@        if (null == array) {@b@            return null;@b@        } else {@b@            StringBuilder sb = new StringBuilder();@b@            boolean isFirst = true;@b@            long[] arr$ = array;@b@            int len$ = array.length;@b@@b@            for(int i$ = 0; i$ < len$; ++i$) {@b@                long item = arr$[i$];@b@                if (isFirst) {@b@                    isFirst = false;@b@                } else {@b@                    sb.append(conjunction);@b@                }@b@@b@                sb.append(item);@b@            }@b@@b@            return sb.toString();@b@        }@b@    }@b@@b@    public static String join(int[] array, CharSequence conjunction) {@b@        if (null == array) {@b@            return null;@b@        } else {@b@            StringBuilder sb = new StringBuilder();@b@            boolean isFirst = true;@b@            int[] arr$ = array;@b@            int len$ = array.length;@b@@b@            for(int i$ = 0; i$ < len$; ++i$) {@b@                int item = arr$[i$];@b@                if (isFirst) {@b@                    isFirst = false;@b@                } else {@b@                    sb.append(conjunction);@b@                }@b@@b@                sb.append(item);@b@            }@b@@b@            return sb.toString();@b@        }@b@    }@b@@b@    public static String join(short[] array, CharSequence conjunction) {@b@        if (null == array) {@b@            return null;@b@        } else {@b@            StringBuilder sb = new StringBuilder();@b@            boolean isFirst = true;@b@            short[] arr$ = array;@b@            int len$ = array.length;@b@@b@            for(int i$ = 0; i$ < len$; ++i$) {@b@                short item = arr$[i$];@b@                if (isFirst) {@b@                    isFirst = false;@b@                } else {@b@                    sb.append(conjunction);@b@                }@b@@b@                sb.append(item);@b@            }@b@@b@            return sb.toString();@b@        }@b@    }@b@@b@    public static String join(char[] array, CharSequence conjunction) {@b@        if (null == array) {@b@            return null;@b@        } else {@b@            StringBuilder sb = new StringBuilder();@b@            boolean isFirst = true;@b@            char[] arr$ = array;@b@            int len$ = array.length;@b@@b@            for(int i$ = 0; i$ < len$; ++i$) {@b@                char item = arr$[i$];@b@                if (isFirst) {@b@                    isFirst = false;@b@                } else {@b@                    sb.append(conjunction);@b@                }@b@@b@                sb.append(item);@b@            }@b@@b@            return sb.toString();@b@        }@b@    }@b@@b@    public static String join(byte[] array, CharSequence conjunction) {@b@        if (null == array) {@b@            return null;@b@        } else {@b@            StringBuilder sb = new StringBuilder();@b@            boolean isFirst = true;@b@            byte[] arr$ = array;@b@            int len$ = array.length;@b@@b@            for(int i$ = 0; i$ < len$; ++i$) {@b@                byte item = arr$[i$];@b@                if (isFirst) {@b@                    isFirst = false;@b@                } else {@b@                    sb.append(conjunction);@b@                }@b@@b@                sb.append(item);@b@            }@b@@b@            return sb.toString();@b@        }@b@    }@b@@b@    public static String join(boolean[] array, CharSequence conjunction) {@b@        if (null == array) {@b@            return null;@b@        } else {@b@            StringBuilder sb = new StringBuilder();@b@            boolean isFirst = true;@b@            boolean[] arr$ = array;@b@            int len$ = array.length;@b@@b@            for(int i$ = 0; i$ < len$; ++i$) {@b@                boolean item = arr$[i$];@b@                if (isFirst) {@b@                    isFirst = false;@b@                } else {@b@                    sb.append(conjunction);@b@                }@b@@b@                sb.append(item);@b@            }@b@@b@            return sb.toString();@b@        }@b@    }@b@@b@    public static String join(float[] array, CharSequence conjunction) {@b@        if (null == array) {@b@            return null;@b@        } else {@b@            StringBuilder sb = new StringBuilder();@b@            boolean isFirst = true;@b@            float[] arr$ = array;@b@            int len$ = array.length;@b@@b@            for(int i$ = 0; i$ < len$; ++i$) {@b@                float item = arr$[i$];@b@                if (isFirst) {@b@                    isFirst = false;@b@                } else {@b@                    sb.append(conjunction);@b@                }@b@@b@                sb.append(item);@b@            }@b@@b@            return sb.toString();@b@        }@b@    }@b@@b@    public static String join(double[] array, CharSequence conjunction) {@b@        if (null == array) {@b@            return null;@b@        } else {@b@            StringBuilder sb = new StringBuilder();@b@            boolean isFirst = true;@b@            double[] arr$ = array;@b@            int len$ = array.length;@b@@b@            for(int i$ = 0; i$ < len$; ++i$) {@b@                double item = arr$[i$];@b@                if (isFirst) {@b@                    isFirst = false;@b@                } else {@b@                    sb.append(conjunction);@b@                }@b@@b@                sb.append(item);@b@            }@b@@b@            return sb.toString();@b@        }@b@    }@b@@b@    public static String join(Object array, CharSequence conjunction) {@b@        if (isArray(array)) {@b@            Class<?> componentType = array.getClass().getComponentType();@b@            if (componentType.isPrimitive()) {@b@                String componentTypeName = componentType.getName();@b@                byte var5 = -1;@b@                switch(componentTypeName.hashCode()) {@b@                case -1325958191:@b@                    if (componentTypeName.equals("double")) {@b@                        var5 = 7;@b@                    }@b@                    break;@b@                case 104431:@b@                    if (componentTypeName.equals("int")) {@b@                        var5 = 1;@b@                    }@b@                    break;@b@                case 3039496:@b@                    if (componentTypeName.equals("byte")) {@b@                        var5 = 4;@b@                    }@b@                    break;@b@                case 3052374:@b@                    if (componentTypeName.equals("char")) {@b@                        var5 = 3;@b@                    }@b@                    break;@b@                case 3327612:@b@                    if (componentTypeName.equals("long")) {@b@                        var5 = 0;@b@                    }@b@                    break;@b@                case 64711720:@b@                    if (componentTypeName.equals("boolean")) {@b@                        var5 = 5;@b@                    }@b@                    break;@b@                case 97526364:@b@                    if (componentTypeName.equals("float")) {@b@                        var5 = 6;@b@                    }@b@                    break;@b@                case 109413500:@b@                    if (componentTypeName.equals("short")) {@b@                        var5 = 2;@b@                    }@b@                }@b@@b@                switch(var5) {@b@                case 0:@b@                    return join((long[])((long[])array), conjunction);@b@                case 1:@b@                    return join((int[])((int[])array), conjunction);@b@                case 2:@b@                    return join((short[])((short[])array), conjunction);@b@                case 3:@b@                    return join((char[])((char[])array), conjunction);@b@                case 4:@b@                    return join((byte[])((byte[])array), conjunction);@b@                case 5:@b@                    return join((boolean[])((boolean[])array), conjunction);@b@                case 6:@b@                    return join((float[])((float[])array), conjunction);@b@                case 7:@b@                    return join((double[])((double[])array), conjunction);@b@                default:@b@                    throw new UtilException("Unknown primitive type: [{}]", new Object[]{componentTypeName});@b@                }@b@            } else {@b@                return join((Object[])((Object[])array), conjunction);@b@            }@b@        } else {@b@            throw new UtilException(StrUtil.format("[{}] is not a Array!", new Object[]{array.getClass()}));@b@        }@b@    }@b@@b@    public static byte[] toArray(ByteBuffer bytebuffer) {@b@        if (!bytebuffer.hasArray()) {@b@            int oldPosition = bytebuffer.position();@b@            bytebuffer.position(0);@b@            int size = bytebuffer.limit();@b@            byte[] buffers = new byte[size];@b@            bytebuffer.get(buffers);@b@            bytebuffer.position(oldPosition);@b@            return buffers;@b@        } else {@b@            return Arrays.copyOfRange(bytebuffer.array(), bytebuffer.position(), bytebuffer.limit());@b@        }@b@    }@b@@b@    public static <T> T[] toArray(Iterator<T> iterator, Class<T> componentType) {@b@        return toArray((Collection)CollectionUtil.newArrayList(iterator), componentType);@b@    }@b@@b@    public static <T> T[] toArray(Iterable<T> iterable, Class<T> componentType) {@b@        return toArray(CollectionUtil.toCollection(iterable), componentType);@b@    }@b@@b@    public static <T> T[] toArray(Collection<T> collection, Class<T> componentType) {@b@        T[] array = newArray(componentType, collection.size());@b@        return collection.toArray(array);@b@    }@b@@b@    public static <T> T[] remove(T[] array, int index) throws IllegalArgumentException {@b@        return (Object[])((Object[])remove((Object)array, index));@b@    }@b@@b@    public static long[] remove(long[] array, int index) throws IllegalArgumentException {@b@        return (long[])((long[])remove((Object)array, index));@b@    }@b@@b@    public static int[] remove(int[] array, int index) throws IllegalArgumentException {@b@        return (int[])((int[])remove((Object)array, index));@b@    }@b@@b@    public static short[] remove(short[] array, int index) throws IllegalArgumentException {@b@        return (short[])((short[])remove((Object)array, index));@b@    }@b@@b@    public static char[] remove(char[] array, int index) throws IllegalArgumentException {@b@        return (char[])((char[])remove((Object)array, index));@b@    }@b@@b@    public static byte[] remove(byte[] array, int index) throws IllegalArgumentException {@b@        return (byte[])((byte[])remove((Object)array, index));@b@    }@b@@b@    public static double[] remove(double[] array, int index) throws IllegalArgumentException {@b@        return (double[])((double[])remove((Object)array, index));@b@    }@b@@b@    public static float[] remove(float[] array, int index) throws IllegalArgumentException {@b@        return (float[])((float[])remove((Object)array, index));@b@    }@b@@b@    public static boolean[] remove(boolean[] array, int index) throws IllegalArgumentException {@b@        return (boolean[])((boolean[])remove((Object)array, index));@b@    }@b@@b@    public static Object remove(Object array, int index) throws IllegalArgumentException {@b@        if (null == array) {@b@            return array;@b@        } else {@b@            int length = length(array);@b@            if (index >= 0 && index < length) {@b@                Object result = Array.newInstance(array.getClass().getComponentType(), length - 1);@b@                System.arraycopy(array, 0, result, 0, index);@b@                if (index < length - 1) {@b@                    System.arraycopy(array, index + 1, result, index, length - index - 1);@b@                }@b@@b@                return result;@b@            } else {@b@                return array;@b@            }@b@        }@b@    }@b@@b@    public static <T> T[] removeEle(T[] array, T element) throws IllegalArgumentException {@b@        return remove(array, indexOf(array, element));@b@    }@b@@b@    public static long[] removeEle(long[] array, long element) throws IllegalArgumentException {@b@        return remove(array, indexOf(array, element));@b@    }@b@@b@    public static int[] removeEle(int[] array, int element) throws IllegalArgumentException {@b@        return remove(array, indexOf(array, element));@b@    }@b@@b@    public static short[] removeEle(short[] array, short element) throws IllegalArgumentException {@b@        return remove(array, indexOf(array, element));@b@    }@b@@b@    public static char[] removeEle(char[] array, char element) throws IllegalArgumentException {@b@        return remove(array, indexOf(array, element));@b@    }@b@@b@    public static byte[] removeEle(byte[] array, byte element) throws IllegalArgumentException {@b@        return remove(array, indexOf(array, element));@b@    }@b@@b@    public static double[] removeEle(double[] array, double element) throws IllegalArgumentException {@b@        return remove(array, indexOf(array, element));@b@    }@b@@b@    public static float[] removeEle(float[] array, float element) throws IllegalArgumentException {@b@        return remove(array, indexOf(array, element));@b@    }@b@@b@    public static boolean[] removeEle(boolean[] array, boolean element) throws IllegalArgumentException {@b@        return remove(array, indexOf(array, element));@b@    }@b@@b@    public static <T> T[] reverse(T[] array, int startIndexInclusive, int endIndexExclusive) {@b@        if (isEmpty(array)) {@b@            return array;@b@        } else {@b@            int i = startIndexInclusive < 0 ? 0 : startIndexInclusive;@b@@b@            for(int j = Math.min(array.length, endIndexExclusive) - 1; j > i; ++i) {@b@                T tmp = array[j];@b@                array[j] = array[i];@b@                array[i] = tmp;@b@                --j;@b@            }@b@@b@            return array;@b@        }@b@    }@b@@b@    public static <T> T[] reverse(T[] array) {@b@        return reverse((Object[])array, 0, array.length);@b@    }@b@@b@    public static long[] reverse(long[] array, int startIndexInclusive, int endIndexExclusive) {@b@        if (isEmpty(array)) {@b@            return array;@b@        } else {@b@            int i = startIndexInclusive < 0 ? 0 : startIndexInclusive;@b@@b@            for(int j = Math.min(array.length, endIndexExclusive) - 1; j > i; ++i) {@b@                long tmp = array[j];@b@                array[j] = array[i];@b@                array[i] = tmp;@b@                --j;@b@            }@b@@b@            return array;@b@        }@b@    }@b@@b@    public static long[] reverse(long[] array) {@b@        return reverse((long[])array, 0, array.length);@b@    }@b@@b@    public static int[] reverse(int[] array, int startIndexInclusive, int endIndexExclusive) {@b@        if (isEmpty(array)) {@b@            return array;@b@        } else {@b@            int i = startIndexInclusive < 0 ? 0 : startIndexInclusive;@b@@b@            for(int j = Math.min(array.length, endIndexExclusive) - 1; j > i; ++i) {@b@                int tmp = array[j];@b@                array[j] = array[i];@b@                array[i] = tmp;@b@                --j;@b@            }@b@@b@            return array;@b@        }@b@    }@b@@b@    public static int[] reverse(int[] array) {@b@        return reverse((int[])array, 0, array.length);@b@    }@b@@b@    public static short[] reverse(short[] array, int startIndexInclusive, int endIndexExclusive) {@b@        if (isEmpty(array)) {@b@            return array;@b@        } else {@b@            int i = startIndexInclusive < 0 ? 0 : startIndexInclusive;@b@@b@            for(int j = Math.min(array.length, endIndexExclusive) - 1; j > i; ++i) {@b@                short tmp = array[j];@b@                array[j] = array[i];@b@                array[i] = tmp;@b@                --j;@b@            }@b@@b@            return array;@b@        }@b@    }@b@@b@    public static short[] reverse(short[] array) {@b@        return reverse((short[])array, 0, array.length);@b@    }@b@@b@    public static char[] reverse(char[] array, int startIndexInclusive, int endIndexExclusive) {@b@        if (isEmpty(array)) {@b@            return array;@b@        } else {@b@            int i = startIndexInclusive < 0 ? 0 : startIndexInclusive;@b@@b@            for(int j = Math.min(array.length, endIndexExclusive) - 1; j > i; ++i) {@b@                char tmp = array[j];@b@                array[j] = array[i];@b@                array[i] = tmp;@b@                --j;@b@            }@b@@b@            return array;@b@        }@b@    }@b@@b@    public static char[] reverse(char[] array) {@b@        return reverse((char[])array, 0, array.length);@b@    }@b@@b@    public static byte[] reverse(byte[] array, int startIndexInclusive, int endIndexExclusive) {@b@        if (isEmpty(array)) {@b@            return array;@b@        } else {@b@            int i = startIndexInclusive < 0 ? 0 : startIndexInclusive;@b@@b@            for(int j = Math.min(array.length, endIndexExclusive) - 1; j > i; ++i) {@b@                byte tmp = array[j];@b@                array[j] = array[i];@b@                array[i] = tmp;@b@                --j;@b@            }@b@@b@            return array;@b@        }@b@    }@b@@b@    public static byte[] reverse(byte[] array) {@b@        return reverse((byte[])array, 0, array.length);@b@    }@b@@b@    public static double[] reverse(double[] array, int startIndexInclusive, int endIndexExclusive) {@b@        if (isEmpty(array)) {@b@            return array;@b@        } else {@b@            int i = startIndexInclusive < 0 ? 0 : startIndexInclusive;@b@@b@            for(int j = Math.min(array.length, endIndexExclusive) - 1; j > i; ++i) {@b@                double tmp = array[j];@b@                array[j] = array[i];@b@                array[i] = tmp;@b@                --j;@b@            }@b@@b@            return array;@b@        }@b@    }@b@@b@    public static double[] reverse(double[] array) {@b@        return reverse((double[])array, 0, array.length);@b@    }@b@@b@    public static float[] reverse(float[] array, int startIndexInclusive, int endIndexExclusive) {@b@        if (isEmpty(array)) {@b@            return array;@b@        } else {@b@            int i = startIndexInclusive < 0 ? 0 : startIndexInclusive;@b@@b@            for(int j = Math.min(array.length, endIndexExclusive) - 1; j > i; ++i) {@b@                float tmp = array[j];@b@                array[j] = array[i];@b@                array[i] = tmp;@b@                --j;@b@            }@b@@b@            return array;@b@        }@b@    }@b@@b@    public static float[] reverse(float[] array) {@b@        return reverse((float[])array, 0, array.length);@b@    }@b@@b@    public static boolean[] reverse(boolean[] array, int startIndexInclusive, int endIndexExclusive) {@b@        if (isEmpty(array)) {@b@            return array;@b@        } else {@b@            int i = startIndexInclusive < 0 ? 0 : startIndexInclusive;@b@@b@            for(int j = Math.min(array.length, endIndexExclusive) - 1; j > i; ++i) {@b@                boolean tmp = array[j];@b@                array[j] = array[i];@b@                array[i] = tmp;@b@                --j;@b@            }@b@@b@            return array;@b@        }@b@    }@b@@b@    public static boolean[] reverse(boolean[] array) {@b@        return reverse((boolean[])array, 0, array.length);@b@    }@b@@b@    public static <T extends Comparable<? super T>> T min(T[] numberArray) {@b@        if (isEmpty((Object[])numberArray)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            T min = numberArray[0];@b@@b@            for(int i = 0; i < numberArray.length; ++i) {@b@                if (ObjectUtil.compare(min, numberArray[i]) > 0) {@b@                    min = numberArray[i];@b@                }@b@            }@b@@b@            return min;@b@        }@b@    }@b@@b@    public static long min(long... numberArray) {@b@        if (isEmpty(numberArray)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            long min = numberArray[0];@b@@b@            for(int i = 0; i < numberArray.length; ++i) {@b@                if (min > numberArray[i]) {@b@                    min = numberArray[i];@b@                }@b@            }@b@@b@            return min;@b@        }@b@    }@b@@b@    public static int min(int... numberArray) {@b@        if (isEmpty(numberArray)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            int min = numberArray[0];@b@@b@            for(int i = 0; i < numberArray.length; ++i) {@b@                if (min > numberArray[i]) {@b@                    min = numberArray[i];@b@                }@b@            }@b@@b@            return min;@b@        }@b@    }@b@@b@    public static short min(short... numberArray) {@b@        if (isEmpty(numberArray)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            short min = numberArray[0];@b@@b@            for(int i = 0; i < numberArray.length; ++i) {@b@                if (min > numberArray[i]) {@b@                    min = numberArray[i];@b@                }@b@            }@b@@b@            return min;@b@        }@b@    }@b@@b@    public static char min(char... numberArray) {@b@        if (isEmpty(numberArray)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            char min = numberArray[0];@b@@b@            for(int i = 0; i < numberArray.length; ++i) {@b@                if (min > numberArray[i]) {@b@                    min = numberArray[i];@b@                }@b@            }@b@@b@            return min;@b@        }@b@    }@b@@b@    public static byte min(byte... numberArray) {@b@        if (isEmpty(numberArray)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            byte min = numberArray[0];@b@@b@            for(int i = 0; i < numberArray.length; ++i) {@b@                if (min > numberArray[i]) {@b@                    min = numberArray[i];@b@                }@b@            }@b@@b@            return min;@b@        }@b@    }@b@@b@    public static double min(double... numberArray) {@b@        if (isEmpty(numberArray)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            double min = numberArray[0];@b@@b@            for(int i = 0; i < numberArray.length; ++i) {@b@                if (min > numberArray[i]) {@b@                    min = numberArray[i];@b@                }@b@            }@b@@b@            return min;@b@        }@b@    }@b@@b@    public static float min(float... numberArray) {@b@        if (isEmpty(numberArray)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            float min = numberArray[0];@b@@b@            for(int i = 0; i < numberArray.length; ++i) {@b@                if (min > numberArray[i]) {@b@                    min = numberArray[i];@b@                }@b@            }@b@@b@            return min;@b@        }@b@    }@b@@b@    public static <T extends Comparable<? super T>> T max(T[] numberArray) {@b@        if (isEmpty((Object[])numberArray)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            T max = numberArray[0];@b@@b@            for(int i = 0; i < numberArray.length; ++i) {@b@                if (ObjectUtil.compare(max, numberArray[i]) < 0) {@b@                    max = numberArray[i];@b@                }@b@            }@b@@b@            return max;@b@        }@b@    }@b@@b@    public static long max(long... numberArray) {@b@        if (isEmpty(numberArray)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            long max = numberArray[0];@b@@b@            for(int i = 0; i < numberArray.length; ++i) {@b@                if (max < numberArray[i]) {@b@                    max = numberArray[i];@b@                }@b@            }@b@@b@            return max;@b@        }@b@    }@b@@b@    public static int max(int... numberArray) {@b@        if (isEmpty(numberArray)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            int max = numberArray[0];@b@@b@            for(int i = 0; i < numberArray.length; ++i) {@b@                if (max < numberArray[i]) {@b@                    max = numberArray[i];@b@                }@b@            }@b@@b@            return max;@b@        }@b@    }@b@@b@    public static short max(short... numberArray) {@b@        if (isEmpty(numberArray)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            short max = numberArray[0];@b@@b@            for(int i = 0; i < numberArray.length; ++i) {@b@                if (max < numberArray[i]) {@b@                    max = numberArray[i];@b@                }@b@            }@b@@b@            return max;@b@        }@b@    }@b@@b@    public static char max(char... numberArray) {@b@        if (isEmpty(numberArray)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            char max = numberArray[0];@b@@b@            for(int i = 0; i < numberArray.length; ++i) {@b@                if (max < numberArray[i]) {@b@                    max = numberArray[i];@b@                }@b@            }@b@@b@            return max;@b@        }@b@    }@b@@b@    public static byte max(byte... numberArray) {@b@        if (isEmpty(numberArray)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            byte max = numberArray[0];@b@@b@            for(int i = 0; i < numberArray.length; ++i) {@b@                if (max < numberArray[i]) {@b@                    max = numberArray[i];@b@                }@b@            }@b@@b@            return max;@b@        }@b@    }@b@@b@    public static double max(double... numberArray) {@b@        if (isEmpty(numberArray)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            double max = numberArray[0];@b@@b@            for(int i = 0; i < numberArray.length; ++i) {@b@                if (max < numberArray[i]) {@b@                    max = numberArray[i];@b@                }@b@            }@b@@b@            return max;@b@        }@b@    }@b@@b@    public static float max(float... numberArray) {@b@        if (isEmpty(numberArray)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            float max = numberArray[0];@b@@b@            for(int i = 0; i < numberArray.length; ++i) {@b@                if (max < numberArray[i]) {@b@                    max = numberArray[i];@b@                }@b@            }@b@@b@            return max;@b@        }@b@    }@b@@b@    public static int[] swap(int[] array, int index1, int index2) {@b@        if (isEmpty(array)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            int tmp = array[index1];@b@            array[index1] = array[index2];@b@            array[index2] = tmp;@b@            return array;@b@        }@b@    }@b@@b@    public static long[] swap(long[] array, int index1, int index2) {@b@        if (isEmpty(array)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            long tmp = array[index1];@b@            array[index1] = array[index2];@b@            array[index2] = tmp;@b@            return array;@b@        }@b@    }@b@@b@    public static double[] swap(double[] array, int index1, int index2) {@b@        if (isEmpty(array)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            double tmp = array[index1];@b@            array[index1] = array[index2];@b@            array[index2] = tmp;@b@            return array;@b@        }@b@    }@b@@b@    public static float[] swap(float[] array, int index1, int index2) {@b@        if (isEmpty(array)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            float tmp = array[index1];@b@            array[index1] = array[index2];@b@            array[index2] = tmp;@b@            return array;@b@        }@b@    }@b@@b@    public static boolean[] swap(boolean[] array, int index1, int index2) {@b@        if (isEmpty(array)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            boolean tmp = array[index1];@b@            array[index1] = array[index2];@b@            array[index2] = tmp;@b@            return array;@b@        }@b@    }@b@@b@    public static byte[] swap(byte[] array, int index1, int index2) {@b@        if (isEmpty(array)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            byte tmp = array[index1];@b@            array[index1] = array[index2];@b@            array[index2] = tmp;@b@            return array;@b@        }@b@    }@b@@b@    public static char[] swap(char[] array, int index1, int index2) {@b@        if (isEmpty(array)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            char tmp = array[index1];@b@            array[index1] = array[index2];@b@            array[index2] = tmp;@b@            return array;@b@        }@b@    }@b@@b@    public static short[] swap(short[] array, int index1, int index2) {@b@        if (isEmpty(array)) {@b@            throw new IllegalArgumentException("Number array must not empty !");@b@        } else {@b@            short tmp = array[index1];@b@            array[index1] = array[index2];@b@            array[index2] = tmp;@b@            return array;@b@        }@b@    }@b@@b@    public static <T> T[] swap(T[] array, int index1, int index2) {@b@        if (isEmpty(array)) {@b@            throw new IllegalArgumentException("Array must not empty !");@b@        } else {@b@            T tmp = array[index1];@b@            array[index1] = array[index2];@b@            array[index2] = tmp;@b@            return array;@b@        }@b@    }@b@@b@    public static Object swap(Object array, int index1, int index2) {@b@        if (isEmpty(array)) {@b@            throw new IllegalArgumentException("Array must not empty !");@b@        } else {@b@            Object tmp = get(array, index1);@b@            Array.set(array, index1, Array.get(array, index2));@b@            Array.set(array, index2, tmp);@b@            return array;@b@        }@b@    }@b@}
<<推荐下载>>
  • (1) 阿里巴巴Java开发手册8种不同版本
  • (2) Web前端开发视频教程
  • (3) 30+明星讲师PPT课件分享一线大厂架构实战经验
  • (4) java开发_架构篇_视频资源分享_v2208
  • (5) java开发_高级篇_视频资源分享_v2208
  • (6) java开发_进阶篇(中级)_视频资源分享_v2208
  • (7) java开发_入门篇_视频资源分享_v2208
  • (8) 微信小程序开发视频1+167源码+实战demo等下载
  • (9) easy-shopping电子商务java源码(附脚本和安装文档说明)下载
  • (10) java常用的72份知名实用的电子书下载
  • (11) java开发性能优化资料整理大全(8份电子文档+3份实战优化)下载
  • (12) 9个常用的算法设计资料和100以上视频课件内容下载
  • (13) vue开发必备常用手册16件下载
  • (14) 21种不同技术集群方案(es、flink、redis、nginx、zk、lvs、kafka、mysql、k8s等)参考资料下载
  • (15) 20种技术代码规范(js/java/dba/阿里/华为/oracle/mysql等)参考资料下载
  • (16) 微服务五套资料(0-1,架构设计,springcloud,nacos等)下载
  • (17) 架构师(28知识图谱+3套简历模板+6套架构实战文档等)完整资料整理下载
  • (18) 大数据18套实战基础知识+8套简历模板下载
  • (19) 并发编程全套(7套+阿里巴巴+亿级实战等)实战资料下载
  • (20) Kafka九套学习整理知识点全套(面试+笔记+代码api+命令+容备等)资料下载
  • (21) java全套9个不同方向类型的面试题(基础+核心+大厂+架构师+近万套题库等)下载
  • (22) JAVA开发常用API帮助文档大全(超52种以上技术资料,高手必备)下载
  • (23) springcloud超详细139件全套学习实战资料( 视频课件+源码demo+文档资料等)下载
  • 更多推荐>>
  • <<热门文章>>