类 ArrayUtil

java.lang.Object
com.weicoder.common.util.ArrayUtil
直接已知子类:
U.A

public class ArrayUtil extends Object
数组帮助类
作者:
WD
  • 构造器详细资料

    • ArrayUtil

      public ArrayUtil()
  • 方法详细资料

    • array

      public static Object array(String s, Class<?> c)
      根据传入的字符串转换成字符数组
      参数:
      s - 字符串
      c - 要转换的类型
      返回:
      字符数组
    • array

      public static Object array(String s, String sepa, Class<?> c)
      根据传入的字符串转换成字符数组
      参数:
      s - 字符串
      sepa - 分隔符
      c - 要转换的类型
      返回:
      字符数组
    • isArray

      public static boolean isArray(Object obj)
      判断是否数组
      参数:
      obj - 对象
      返回:
      是否数组
    • toList

      @SafeVarargs public static <E> List<E> toList(E... e)
      把数组转换成列表
      类型参数:
      E - 泛型
      参数:
      e - 元素数组
      返回:
      元素列表
    • copy

      public static <E> void copy(E[] src, E[] dest)
      拷贝数组 已dest长度为准
      类型参数:
      E - 泛型
      参数:
      src - 原数组
      dest - 目标数组
    • copy

      public static <E> void copy(E[] src, E[] dest, int pos)
      拷贝数组 已dest长度为准
      类型参数:
      E - 泛型
      参数:
      src - 原数组
      dest - 目标数组
      pos - 从第几位开始
    • copy

      public static <E> void copy(E[] src, int srcPos, E[] dest, int destPos, int length)
      拷贝数组
      类型参数:
      E - 泛型
      参数:
      src - 原数组
      srcPos - 从原数组第几位开始
      dest - 目标数组
      destPos - 从目标组第几位开始
      length - 拷贝长度
    • toInteger

      public static Integer[] toInteger(int[] n)
      把int数组包装成Integer数组
      参数:
      n - int数组
      返回:
      Integer数组
    • toInteger

      public static Integer[] toInteger(String[] s)
      把String数组包装成Integer数组
      参数:
      s - String数组
      返回:
      Integer数组
    • toInt

      public static int[] toInt(Integer[] n)
      把Integer数组转换成int数组
      参数:
      n - Integer数组
      返回:
      int数组
    • toStringArray

      public static String[] toStringArray(Integer[] n)
      把Integer数组转换成String数组
      参数:
      n - Integer数组
      返回:
      String数组
    • toStringArray

      public static String[] toStringArray(Serializable[] a)
      把数组对象转换成字符串
      参数:
      a - 对象数组
      返回:
      字符串
    • toStringArray

      public static String[] toStringArray(Object[] a)
      把数组对象转换成字符串
      参数:
      a - 对象数组
      返回:
      字符串
    • toString

      public static String toString(Object[] a)
      把数组对象转换成字符串
      参数:
      a - 对象数组
      返回:
      字符串
    • add

      public static <E> E[] add(E[] one, E[] two)
      数组相加
      类型参数:
      E - 泛型
      参数:
      one - 第一个数组因数
      two - 第二个数组因数
      返回:
      相加后的数组
    • add

      public static <E> E[] add(E[] one, E[] two, int twoLength)
      数组相加
      类型参数:
      E - 泛型
      参数:
      one - 第一个数组因数
      two - 第二个数组因数
      twoLength - 第二个数组长度 一共相加多少长度
      返回:
      相加后的数组
    • add

      public static <E> E[] add(E[] one, int onePos, int oneLength, E[] two, int twoPos, int twoLength)
      数组相加
      类型参数:
      E - 泛型
      参数:
      one - 第一个数组因数
      onePos - 第一个数组偏移 从第几个元素开始
      oneLength - 第一个数组长度 一共相加多少长度
      two - 第二个数组因数
      twoPos - 第二个数组偏移 从第几个元素开始
      twoLength - 第二个数组长度 一共相加多少长度
      返回:
      相加后的数组
    • getArray

      public static <E> E[] getArray(Class<E> clazz, int length)
      获得数据
      类型参数:
      E - 泛型
      参数:
      clazz - 数组类型
      length - 数组长度
      返回:
      数组
    • getArray

      @SafeVarargs public static <E> E[] getArray(E... e)
      获得数组
      类型参数:
      E - 泛型
      参数:
      e - 要组成数据的参数
      返回:
      e数组