text java createwordlist method clean up
This commit is contained in:
parent
6ecda2c63c
commit
547db94893
|
@ -140,7 +140,7 @@ public class Text {
|
||||||
*/
|
*/
|
||||||
public ArrayList<String> index() {
|
public ArrayList<String> index() {
|
||||||
HashMap<String,ArrayList<Integer>> wordbook = new HashMap<>();
|
HashMap<String,ArrayList<Integer>> wordbook = new HashMap<>();
|
||||||
wordbook = createWordlist(wordbook);
|
createWordlist(wordbook);
|
||||||
String input;
|
String input;
|
||||||
ArrayList<String> output = new ArrayList<>();
|
ArrayList<String> output = new ArrayList<>();
|
||||||
ArrayList<Integer> values;
|
ArrayList<Integer> values;
|
||||||
|
@ -168,7 +168,7 @@ public class Text {
|
||||||
*
|
*
|
||||||
* @return HashMap<String, ArrayList < Integer>>
|
* @return HashMap<String, ArrayList < Integer>>
|
||||||
*/
|
*/
|
||||||
private HashMap<String, ArrayList<Integer>> createWordlist(HashMap<String,ArrayList<Integer>> wordbook) {
|
private void createWordlist(HashMap<String,ArrayList<Integer>> wordbook) {
|
||||||
int counter;
|
int counter;
|
||||||
ArrayList<Integer> numbersList;
|
ArrayList<Integer> numbersList;
|
||||||
String firstLetter;
|
String firstLetter;
|
||||||
|
@ -187,7 +187,6 @@ public class Text {
|
||||||
counter = numbersList.get(0);
|
counter = numbersList.get(0);
|
||||||
numbersList.remove(0);
|
numbersList.remove(0);
|
||||||
numbersList.add(0, counter + 1);
|
numbersList.add(0, counter + 1);
|
||||||
|
|
||||||
if (numbersList.get(numbersList.size() - 1) < i + 1) {
|
if (numbersList.get(numbersList.size() - 1) < i + 1) {
|
||||||
numbersList.add(i + 1);
|
numbersList.add(i + 1);
|
||||||
}
|
}
|
||||||
|
@ -199,7 +198,6 @@ public class Text {
|
||||||
wordbook.put(word, numbersList);
|
wordbook.put(word, numbersList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return wordbook;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue