Java Utililty Methods Primitive Type Create

List of utility methods to do Primitive Type Create

Description

The list of methods to do Primitive Type Create are organized into topic(s).

Method

double[]toPrimitive(Double[] array)
Converts an array[] of object Doubles to primitives[].
double[] newArray = new double[array.length];
for (int i = 0; i < array.length; i++) {
    newArray[i] = array[i];
return newArray;
double[]toPrimitive(Double[] doubles)
to Primitive
double[] dArray = new double[doubles.length];
int i = 0;
for (double d : doubles) {
    dArray[i++] = d;
return dArray;
double[]toPrimitive(Double[] vals)
to Primitive
double[] v = new double[vals.length];
for (int i = 0; i < v.length; i++) {
    v[i] = vals[i];
return v;
booleantoPrimitive(final Boolean b)
to Primitive
return b == null ? false : b.booleanValue();
chartoPrimitive(final Character value, final char defaultValue)
Get the primitive value of an Character .
if (value == null) {
    return defaultValue;
} else {
    return value.charValue();
double[]toPrimitive(final Double[] arr)
Returns a double array containing the double representation of given Double array.
final double[] result = new double[arr.length];
for (int i = 0; i < arr.length; i++)
    result[i] = arr[i];
return result;
float[]toPrimitive(Float[] floats)
Converts an object array of Floats to a primitive array.
float[] primitive = new float[floats.length];
for (int i = 0; i < floats.length; i++) {
    primitive[i] = floats[i];
return primitive;
int[]toPrimitive(Integer[] array)
Converts a Integer array to an int array.
if (array.length == 0) {
    return EMPTY_INT_ARRAY;
int[] result = new int[array.length];
for (int i = 0; i < array.length; i++) {
    result[i] = array[i];
return result;
...
int[]toPrimitive(Integer[] IntArray)
to Primitive
int[] intArray = new int[IntArray.length];
for (int i = 0; i < IntArray.length; i++) {
    intArray[i] = IntArray[i].intValue();
return intArray;
int[]toPrimitive(Integer[] ints)
Converts an array of Integer objects to an array of its primitive form.
int[] retVal = new int[ints.length];
for (int i = 0; i < retVal.length; i++) {
    retVal[i] = ints[i].intValue();
return retVal;