text java createwordlist method clean up

This commit is contained in:
Andrin Fassbind 2021-11-12 08:39:09 +01:00
parent 6ecda2c63c
commit 547db94893
1 changed files with 2 additions and 4 deletions

View File

@ -140,7 +140,7 @@ public class Text {
*/
public ArrayList<String> index() {
HashMap<String,ArrayList<Integer>> wordbook = new HashMap<>();
wordbook = createWordlist(wordbook);
createWordlist(wordbook);
String input;
ArrayList<String> output = new ArrayList<>();
ArrayList<Integer> values;
@ -168,7 +168,7 @@ public class Text {
*
* @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;
ArrayList<Integer> numbersList;
String firstLetter;
@ -187,7 +187,6 @@ public class Text {
counter = numbersList.get(0);
numbersList.remove(0);
numbersList.add(0, counter + 1);
if (numbersList.get(numbersList.size() - 1) < i + 1) {
numbersList.add(i + 1);
}
@ -199,7 +198,6 @@ public class Text {
wordbook.put(word, numbersList);
}
}
return wordbook;
}
}