ScottRogersGC
asked on
How do I concatenate object arrays on the fly?
I have a method that returns an array of objects, this method is called for each item in another array from within a for-loop. I wish to add the new array returned by each of these calls to a single array.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
thank you
ellandrd
ellandrd
what you mean "new array" if you want the returned array be separated from the original you may clone the returned array:
for(...){
Object[] myNewArray = returenedArray.clone();
}
or use System.arraycopy() to copy to new array object
for(...){
Object[] myNewArray = returenedArray.clone();
}
or use System.arraycopy() to copy to new array object
What it not good enough for a grade A?
ellandrd
ellandrd
ASKER
can't go round handing out grade A's every day :-)
Your a Premium Service Member like me - isn't points unlimited? so who cares?
;-)
;-)
ellandrd,
your solution is not efficient
the objects' post is fundamental way of resolving the problem so he is eligible to achieve the points
your solution is not efficient
the objects' post is fundamental way of resolving the problem so he is eligible to achieve the points
System.arraycopy
http://www.objects.com.au/java/qa/1839197685.html