-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
1.4.2
-
Fix Understood
-
x86
-
windows_2000
Name: rmT116609 Date: 11/07/2003
A DESCRIPTION OF THE REQUEST :
I was surprised that class java.util.Arrays does not have a generic method to clone (to make a shallow copy of) ANY array. Here is how it should be used.
int[][][] someMultiDimensionArray = new int[][][] {...};
Object[] Arrays.shallowClone(someMultiDimensionArray, int depth);
used this way
Object[] Arrays.shallowClone(someMultiDimensionArray, 3); // 3 because of 3D array
The user would have the option to decide of the depth of the copy with the depth parameter.
This operation is often done in programming. I would expect to see such method in class java.util.Arrays. The shallowClone()
JUSTIFICATION :
This operation is so frequent in high level programming in Java where we deal with groups (containter) of Objects like Genetic Algorithms, Rules Programming, Agent Programming. I find that it is best not to commit to any specific container like Collection, Vector, Set...etc, because we often really need functionalities from several of these containers depending on the algorithms. So I decided to stay with the simple array to implement groups and I convert to the container needed. I also often have to clone (make exact copy) of the containers and I find myself duplicating clone method over and over.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
int[][][] someMultiDimensionArray = new int[][][] {...};
Object[] Arrays.shallowClone(someMultiDimensionArray, int depth);
used this way
Object[] Arrays.shallowClone(someMultiDimensionArray, 3); // 3 because of 3D array
The user would have the option to decide of the depth of the copy with the depth parameter.
---------- BEGIN SOURCE ----------
int[][][] someMultiDimensionArray = new int[][][] {...};
Object[] Arrays.shallowClone(someMultiDimensionArray, int depth);
used this way
Object[] Arrays.shallowClone(someMultiDimensionArray, 3); // 3 because of 3D array
The user would have the option to decide of the depth of the copy with the depth parameter.
---------- END SOURCE ----------
(Incident Review ID: 224369)
======================================================================
A DESCRIPTION OF THE REQUEST :
I was surprised that class java.util.Arrays does not have a generic method to clone (to make a shallow copy of) ANY array. Here is how it should be used.
int[][][] someMultiDimensionArray = new int[][][] {...};
Object[] Arrays.shallowClone(someMultiDimensionArray, int depth);
used this way
Object[] Arrays.shallowClone(someMultiDimensionArray, 3); // 3 because of 3D array
The user would have the option to decide of the depth of the copy with the depth parameter.
This operation is often done in programming. I would expect to see such method in class java.util.Arrays. The shallowClone()
JUSTIFICATION :
This operation is so frequent in high level programming in Java where we deal with groups (containter) of Objects like Genetic Algorithms, Rules Programming, Agent Programming. I find that it is best not to commit to any specific container like Collection, Vector, Set...etc, because we often really need functionalities from several of these containers depending on the algorithms. So I decided to stay with the simple array to implement groups and I convert to the container needed. I also often have to clone (make exact copy) of the containers and I find myself duplicating clone method over and over.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
int[][][] someMultiDimensionArray = new int[][][] {...};
Object[] Arrays.shallowClone(someMultiDimensionArray, int depth);
used this way
Object[] Arrays.shallowClone(someMultiDimensionArray, 3); // 3 because of 3D array
The user would have the option to decide of the depth of the copy with the depth parameter.
---------- BEGIN SOURCE ----------
int[][][] someMultiDimensionArray = new int[][][] {...};
Object[] Arrays.shallowClone(someMultiDimensionArray, int depth);
used this way
Object[] Arrays.shallowClone(someMultiDimensionArray, 3); // 3 because of 3D array
The user would have the option to decide of the depth of the copy with the depth parameter.
---------- END SOURCE ----------
(Incident Review ID: 224369)
======================================================================