public class BooleanUtils
extends Object
Provides extra functionality for boolean data.
| Modifier and Type | Method and Description |
|---|---|
static boolean[] |
arrayOf(boolean... values)
Generates a
boolean[] from comma-separated values. |
static Boolean[] |
asObjectArray(boolean[] array)
Converts from
boolean[] to Boolean[]. |
static boolean[] |
asPrimitiveArray(Boolean[] array)
Converts from
Boolean[] to boolean[]. |
static <A> Map<A,Boolean> |
constantMap(Set<A> identifiers,
boolean value)
Returns a map filled with a given value.
|
static <A extends Number> |
convertArray2Map(Set<A> identifiers,
boolean[] array)
Returns a map containing the association of each identifier with its corresponding
value within the array (in linear order).
|
static <A extends Number,B extends Number> |
convertTable2Map(Set<A> rowIdentifiers,
Set<B> columnIdentifiers,
boolean[][] table)
Returns a map containing the association of each identifier pair with its corresponding
value within the table (in linear order).
|
static int[] |
find(boolean[] array,
boolean value,
Constants.SearchType searchType)
Returns the position(s) where a given value can be found into an array.
|
static boolean[] |
select(boolean[] array,
int[] indexes)
Returns a set of selected elements from an input array.
|
static boolean[] |
toArray(Collection<Boolean> list)
Converts a collection (
List, Set...) of Boolean objects to a boolean[]. |
static List<Boolean> |
toList(boolean[] array)
Converts from a
boolean[] to a list. |
public static boolean[] arrayOf(boolean... values)
boolean[] from comma-separated values.values - Comma-separated boolean valuesboolean[]public static Boolean[] asObjectArray(boolean[] array)
boolean[] to Boolean[].array - boolean[]Boolean[]public static boolean[] asPrimitiveArray(Boolean[] array)
Boolean[] to boolean[].array - Boolean[]boolean[]public static <A> Map<A,Boolean> constantMap(Set<A> identifiers,
boolean value)
A - Key typeidentifiers - Set of map keysvalue - Value for all elementspublic static <A extends Number> Map<A,Boolean> convertArray2Map(Set<A> identifiers,
boolean[] array)
A - Key typeidentifiers - Set of identifier in ascending iterator order (duplicated and null values are not allowed)array - Input arraypublic static <A extends Number,B extends Number> Map<Pair<A,B>,Boolean> convertTable2Map(Set<A> rowIdentifiers, Set<B> columnIdentifiers, boolean[][] table)
A - Row key typeB - Column key typerowIdentifiers - Set of row identifiers in ascending iterator order (null values are not allowed)columnIdentifiers - Set of column identifiers in ascending iterator order (duplicated and null values are not allowed)table - Input tablepublic static int[] find(boolean[] array,
boolean value,
Constants.SearchType searchType)
array - Input arrayvalue - Value to be searched forsearchType - Indicates whether the first, the last, or all occurrences are returnedpublic static boolean[] select(boolean[] array,
int[] indexes)
array - Input arrayindexes - Position of elements to be selected.indexespublic static boolean[] toArray(Collection<Boolean> list)
List, Set...) of Boolean objects to a boolean[].list - Input listboolean[]public static List<Boolean> toList(boolean[] array)
boolean[] to a list.array - Input arrayBoolean objects