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:
@@ -483,6 +483,36 @@ public class IntListUtil
|
|||||||
return newlist;
|
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
|
* The size of a list to create if we have to create one entirely
|
||||||
* from scratch rather than just expand it.
|
* from scratch rather than just expand it.
|
||||||
|
|||||||
Reference in New Issue
Block a user