@Override public PersistedData serializeCollection(Collection<Boolean> value, SerializationContext context) { return context.create(Booleans.toArray(value)); }
@Override protected boolean[] getBooleanArrayInternal(int columnIndex) { return Booleans.toArray(getBooleanListInternal(columnIndex)); }
public void testToArray_withNull() { List<Boolean> list = Arrays.asList(false, true, null); try { Booleans.toArray(list); fail(); } catch (NullPointerException expected) { } }
public void testToArray() { // need explicit type parameter to avoid javac warning!? List<Boolean> none = Arrays.<Boolean>asList(); assertTrue(Arrays.equals(EMPTY, Booleans.toArray(none))); List<Boolean> one = Arrays.asList(false); assertTrue(Arrays.equals(ARRAY_FALSE, Booleans.toArray(one))); boolean[] array = {false, false, true}; List<Boolean> three = Arrays.asList(false, false, true); assertTrue(Arrays.equals(array, Booleans.toArray(three))); assertTrue(Arrays.equals(array, Booleans.toArray(Booleans.asList(array)))); }
public void testToArray_threadSafe() { // Only for booleans, we lengthen VALUES boolean[] VALUES = BooleansTest.VALUES; VALUES = Booleans.concat(VALUES, VALUES); for (int delta : new int[] {+1, 0, -1}) { for (int i = 0; i < VALUES.length; i++) { List<Boolean> list = Booleans.asList(VALUES).subList(0, i); Collection<Boolean> misleadingSize = Helpers.misleadingSizeCollection(delta); misleadingSize.addAll(list); boolean[] arr = Booleans.toArray(misleadingSize); assertEquals(i, arr.length); for (int j = 0; j < i; j++) { assertEquals(VALUES[j], arr[j]); } } } }
type = Type.BOOLEAN_TYPE; nulls = toBitset(colValues.getBoolVal().getNulls()); boolVars = Booleans.toArray(colValues.getBoolVal().getValues()); size = boolVars.length; } else if (colValues.isSetByteVal()) {
@Override protected boolean[] createArray(List<Boolean> elements) { return Booleans.toArray(elements); } }
@Override public boolean[] apply(List<Boolean> input) { return null == input ? null : Booleans.toArray(input); }}; protected final Table<Class<?>,Class<?>,Function<?,?>> transTable = HashBasedTable.create();
@Override public boolean[] apply(List<Boolean> input) { return null == input ? null : Booleans.toArray(input); }}; protected final Table<Class<?>,Class<?>,Function<?,?>> transTable = HashBasedTable.create();
@Override protected boolean[] createArray(List<Boolean> elements) { return Booleans.toArray(elements); } }
@Override protected boolean[] getBooleanArrayInternal(int columnIndex) { return Booleans.toArray(getBooleanListInternal(columnIndex)); }
public boolean[] generateBooleanArray(int count) { List<Boolean> objects = generateList(Boolean.class, count); return Booleans.toArray(objects); }
public void testToArray_withNull() { List<Boolean> list = Arrays.asList(false, true, null); try { Booleans.toArray(list); fail(); } catch (NullPointerException expected) { } }
return Booleans.toArray(wrapperList); } else if (float.class.equals(primitiveType)) { return Floats.toArray(wrapperList);
public void testToArray() { // need explicit type parameter to avoid javac warning!? List<Boolean> none = Arrays.<Boolean>asList(); assertTrue(Arrays.equals(EMPTY, Booleans.toArray(none))); List<Boolean> one = Arrays.asList(false); assertTrue(Arrays.equals(ARRAY_FALSE, Booleans.toArray(one))); boolean[] array = {false, false, true}; List<Boolean> three = Arrays.asList(false, false, true); assertTrue(Arrays.equals(array, Booleans.toArray(three))); assertTrue(Arrays.equals(array, Booleans.toArray(Booleans.asList(array)))); }
private BooleanTensor extractBoolTensor(KeanuSavedBayesNet.BooleanTensor tensor) { return BooleanTensor.create( Booleans.toArray(tensor.getValuesList()), Longs.toArray(tensor.getShapeList())); } }
/** * @param clazz type of elements in the {@code value} list; must be one of {@code Boolean.class}, * {@code Integer.class}, {@code Long.class}, {@code Double.class}, {@code String.class} * or {@code ModelNode.class} * @throws IllegalArgumentException if {@code clazz} is not one of the known types * @throws ClassCastException if some elements of the {@code value} list are not of type {@code clazz} * @throws ArrayStoreException if some elements of the {@code value} list are not of type {@code clazz} */ @SuppressWarnings({"unchecked", "SuspiciousToArrayCall"}) public <T> Values andList(Class<T> clazz, String name, List<T> value) { if (clazz == Boolean.class) { return andList(name, Booleans.toArray((List<Boolean>) value)); } else if (clazz == Integer.class) { return andList(name, Ints.toArray((List<Integer>) value)); } else if (clazz == Long.class) { return andList(name, Longs.toArray((List<Long>) value)); } else if (clazz == Double.class) { return andList(name, Doubles.toArray((List<Double>) value)); } else if (clazz == String.class) { return andList(name, value.toArray(new String[value.size()])); } else if (clazz == ModelNode.class) { return andList(name, value.toArray(new ModelNode[value.size()])); } else { throw new IllegalArgumentException("Only List<Boolean>, List<Integer>, List<Long>, List<Double>, " + "List<String> and List<ModelNode> are supported"); } }
public void testToArray_threadSafe() { // Only for booleans, we lengthen VALUES boolean[] VALUES = BooleansTest.VALUES; VALUES = Booleans.concat(VALUES, VALUES); for (int delta : new int[] { +1, 0, -1 }) { for (int i = 0; i < VALUES.length; i++) { List<Boolean> list = Booleans.asList(VALUES).subList(0, i); Collection<Boolean> misleadingSize = Helpers.misleadingSizeCollection(delta); misleadingSize.addAll(list); boolean[] arr = Booleans.toArray(misleadingSize); assertEquals(i, arr.length); for (int j = 0; j < i; j++) { assertEquals(VALUES[j], arr[j]); } } } }
type = Type.BOOLEAN_TYPE; nulls = toBitset(colValues.getBoolVal().getNulls()); boolVars = Booleans.toArray(colValues.getBoolVal().getValues()); size = boolVars.length; } else if (colValues.isSetByteVal()) {
type = Type.BOOLEAN_TYPE; nulls = toBitset(colValues.getBoolVal().getNulls()); boolVars = Booleans.toArray(colValues.getBoolVal().getValues()); size = boolVars.length; } else if (colValues.isSetByteVal()) {