I need to "extract" if you will, one particular row of a multi array of comparables. I know the index of the row, I just need a copy of it. I tried just doing something like:
masterList is the multiarray that I need to extract from.
Comparable[] extracted = masterList[i];
This however only sets extracted to the address and not the actual contents.
Is there an easy way to do this?
If not can I create an empty Comparable[] of the same length as the masterList[i] row and loop through to add to it? Please note that my program doesn't start off knowing the length of the row it needs so I can't hard code it into the program.
Updated code:
Comparable[][] comparable = Arrays.copyOf(masterList, masterList[i].length);
When I ran this I did get an array of the length I need but it was all addresses, not values. So I ran a loop to add the values
for(int i = 0; i<comparable.length; ++i){
comparable[i] = queries[masterIndex];
}
this however still returns a list of addresses.