I have created a duplicate array using this code
List<Games> gameSortList = new ArrayList<Games>(gamesList);
I am very new to this concept and don't really know how it works. I am using this duplicate array list to sort the original without editing it. However the new array list does not allow me to use any of the gets and sets for the original array list. Am I even declaring it right ?
Here is the declaration of the duplicate
private void BtnAscActionPerformed(java.awt.event.ActionEvent evt) {
if (evt.getActionCommand().equals("⇑")) {
List<Games> gameSortList = new ArrayList<Games>(gamesList);
int newSmall = 9999999 ;
int smallIndex = 0;
switch (RadSelection){
case "index":
while (gameSortList.size() != 0) {
for (int i = 0; i < gameSortList.size(); i++) {
// if (gameSortList.) {
gameSortList.getDev();
// }
}
}
break;
case "Meta":
break;
case "Personal":
break;
}
}
}
.getdev
is one of the methods used for the Games
class which is used in gamesList
What im trying to go is this psudo code :
Make Duplicate array list
smallnum = 99999;
smallIndex = 0
until ( GetSizeOfDuplicate = 0){
for ( i > GetSizeOfDuplicate , i ++)
If Duplicate.getRank < small num{
smallnum = Duplicate.getRank
smallIndex = i }
print Duplicate.getRank(smallIndex )
delete Duplicate.getRank(smallIndex )
smallnum = 99999;
}loop