Sorting an ArrayList of Strings
source link: http://programmingbydoing.com/a/sorting-an-arraylist-of-strings.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
- Author: Graham Mitchell
- Filename: SortingAnArraylistOfStrings.java
Sorting an ArrayList of Strings
Write a program that creates an ArrayList of Strings. Make up ten or more random words (all lowercase) and put them in the ArrayList in any way you choose. Display them on the screen. Then, using the sort of your choice, arrange the words in alphabetical order and display them again.
Just like last time, you must put the sorting code in its own function.
ArrayList before: [ask, not, what, your, country, can, do, for, you, but] ArrayList after : [ask, but, can, country, do, for, not, what, you, your]
©2013 Graham Mitchell
This assignment is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK