does java sort list after removing an item from a list

Solutions on MaxInterview for does java sort list after removing an item from a list by the best coders in the world

showing results for - "does java sort list after removing an item from a list"
Malo
05 Jul 2016
1//yes
2//if you remove an item from the list,
3//the list will stay sorted
4
5//example :
6
7for(int i = 0;i < 10;i++)
8    myList.add(""+i);
9
10System.out.println(myList);
11//Before removal: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
12//myList[3] = 3
13//myList.size() = 10
14myList.remove(3);
15myList.remove(4);
16myList.remove(5);
17
18System.out.println(myList);
19//After removal: [0, 1, 2, 4, 6, 8, 9]
20//myList[3] = 4
21////myList.size() = 7