Java Boolean From toBooleanArray(final Object[] array)

Here you can find the source of toBooleanArray(final Object[] array)

Description

to Boolean Array

License

Open Source License

Declaration

public static boolean[] toBooleanArray(final Object[] array) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static boolean[] toBooleanArray(final Object[] array) {
        if (array == null) {
            return new boolean[0];
        }//from   www  .  j a  v a  2  s  .  co m

        final boolean[] retVal = new boolean[array.length];

        try {
            for (int i = 0; i < array.length; i++) {
                retVal[i] = Boolean.parseBoolean(String.valueOf(array[i]));
            }

            return retVal;
        } catch (Exception e) {
            return new boolean[0];
        }
    }
}

Related

  1. toBooleanArray(byte a, boolean[] buf)
  2. toBooleanArray(byte[] array)
  3. toBooleanArray(byte[] byteArray)
  4. toBooleanArray(byte[] data)
  5. toBooleanArray(final E[] array)
  6. toBooleanArray(int[] intArray, int n)
  7. toBooleanArray(Object[] vs)
  8. toBooleanDefaultIfNull(Boolean bool, boolean valueIfNull)
  9. toBooleanDefaultIfNull(Boolean bool, boolean valueIfNull)