/** * Get the optional boolean value associated with an index. * It returns the defaultValue if there is no value at that index or if * it is not a Boolean or the String "true" or "false" (case insensitive). * * @param index The index must be between 0 and length() - 1. * @param defaultValue A boolean default. * @return The truth. */ public boolean getBoolean(int index, boolean defaultValue) { try { return getBoolean(index); } catch (Exception e) { return defaultValue; } }
/** * Get the optional boolean value associated with an index. * It returns the defaultValue if there is no value at that index or if * it is not a Boolean or the String "true" or "false" (case insensitive). * * @param index The index must be between 0 and length() - 1. * @param defaultValue A boolean default. * @return The truth. */ public boolean getBoolean(int index, boolean defaultValue) { try { return getBoolean(index); } catch (Exception e) { return defaultValue; } }
/** Get this entire array as a boolean array. Everything must be a boolean. */ public boolean[] getBooleanArray() { boolean[] outgoing = new boolean[size()]; for (int i = 0; i < size(); i++) { outgoing[i] = getBoolean(i); } return outgoing; }
/** Get this entire array as a boolean array. Everything must be a boolean. */ public boolean[] getBooleanArray() { boolean[] outgoing = new boolean[size()]; for (int i = 0; i < size(); i++) { outgoing[i] = getBoolean(i); } return outgoing; }