有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!


共 (1) 个答案

  1. # 1 楼答案

    阿帕奇ArrayUtils.toPrimitive

    public static boolean[] toPrimitive(Boolean[] array, boolean valueForNull) Converts an array of object Booleans to primitives handling null.

    This method returns null for a null input array.

    但是,此方法需要一个布尔数组,因此首先需要使用toArray将列表转换为数组

    ArrayUtils.toPrimitive(list.toArray(ArrayUtils.EMPTY_BOOLEAN_OBJECT_ARRAY));
    

    您需要下载ApacheCommonsLang库

    https://commons.apache.org/proper/commons-lang/download_lang.cgi