A jab to the left, a jab to the right, next thing you know you're boxing.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1980 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2006-11-21 01:06:49 +00:00
parent 73ed588a2c
commit 1b04037740
@@ -483,6 +483,36 @@ public class IntListUtil
return newlist;
}
/**
* Covnerts an array of primitives to an array of objects.
*/
public static Integer[] box (int[] list)
{
if (list == null) {
return null;
}
Integer[] boxed = new Integer[list.length];
for (int ii = 0; ii < list.length; ii++) {
boxed[ii] = list[ii];
}
return boxed;
}
/**
* Converts an array of Integer objects to an array of primitives.
*/
public static int[] unbox (Integer[] list)
{
if (list == null) {
return null;
}
int[] unboxed = new int[list.length];
for (int ii = 0; ii < list.length; ii++) {
unboxed[ii] = list[ii];
}
return unboxed;
}
/**
* The size of a list to create if we have to create one entirely
* from scratch rather than just expand it.