com.eurodyn.qlack.commons.arrays.ArraysHelper Maven / Gradle / Ivy
package com.eurodyn.qlack.commons.arrays;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author European Dynamics SA
*/
public class ArraysHelper {
private ArraysHelper() {
}
/**
* Useful to convert an array to a list when Arrays.asList does not properly keep the underlying data-type (usual case
* when you try to add an array in a JPA-query in the 'in' clause).
*/
public static List arrayToList(T[] a) {
List retVal = new ArrayList(a.length);
retVal.addAll(Arrays.asList(a));
return retVal;
}
/**
* Convert a byte array to a list of (Bytes).
*
* @return List
*/
public static List arrayToList(byte[] a) {
List retVal = new ArrayList(a.length);
for (byte i : a) {
retVal.add(i);
}
return retVal;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy