/ Published in: Java
Create a List for a specified number strings with a specified max characters (randomized...1-max). This method uses another snippet which contains initCharacterList(int, int) http://snipplr.com/view/71355/fill-character-list-from-ascii-table-and-sort/
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
private List<String> initStringList(int maxNumberOfCharacters, int numberOfStrings) { // init place holder for sorted list List<String> list = new ArrayList<>(); for (int i = 0; i < numberOfStrings; i++) { // init a mutable string to add characters to // generate random number 1 - numberOfCharacters // generate random ascii start place between 33 - 100 // going to use initCharacterList(int) to fill strings // append characters to String strBuffer.append(c); } // convert to String and add to list list.add(strBuffer.toString()); } // sort list return list; }