I know very little of bytecode and compiled code. I have a method that is in a path where performance is very critical. There is an alternative way of doing the same with java's API and an apache library. But I'm concerned that involving two extra classes will render the method slower. So my question is, regarding performance, is there any advantage in using your own code?
These are the method with my own code and using libraries:
public final static List<Long> longArrayToLongList(long[] array)
{
if (array == null)
{
return null;
}
List<Long> list = new ArrayList<Long>(array.length);
for (long value : array)
{
list.add(Long.valueOf(value));
}
return list;
}
public final static List<Long> longArrayToLongListWithLib(long[] array)
{
return Arrays.asList(ArrayUtils.toObject(array));
}