does java sort list after removing an item from a list code example
Example: does java sort list after removing an item from a list
//yes
//if you remove an item from the list,
//the list will stay sorted
//example :
for(int i = 0;i < 10;i++)
myList.add(""+i);
System.out.println(myList);
//Before removal: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
//myList[3] = 3
//myList.size() = 10
myList.remove(3);
myList.remove(4);
myList.remove(5);
System.out.println(myList);
//After removal: [0, 1, 2, 4, 6, 8, 9]
//myList[3] = 4
////myList.size() = 7