Answers for "does java sort list after removing an item from a list"

1

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
Posted by: Guest on April-29-2021

Code answers related to "does java sort list after removing an item from a list"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language