Sort an ArrayList JAVA
Hi! I need help with sorting ArrayList with foreach loop: https://code.sololearn.com/chjjRqCXgo0n Also, how to display 5th element in the sorted list, delete the state at index 6 and identify which state was removed. Any help is much appreciated!
2/8/2018 10:47:21 PMDIY Mods
1 AnswerNew Answer
U can use "Arrays.sort (arrayname);" to sort the array & then pickup 5 th element by writing arrarname; & U can remove the content from at index 6th by writing arrayname =""; &to identify , which state content was removed , U can run a loop & putting a if condition in it ... arrayname [a].equals ("") ... if thats evaluates to true ... means index a element's content was removed