public List<Integer> asList(final int[] is)
{
return new AbstractList<Integer>() {
public Integer get(int i) { return is[i]; }
public int size() { return is.length; }
};
}
The smallest piece of code would be
public List<Integer> myWork(int[] array) {
return Arrays.asList(ArrayUtils.toObject(array));
}
where ArrayUtils comes from commons-lang :)
No comments:
Post a Comment