Here you can find the source of toWords(String content)
public static ArrayList<String> toWords(String content)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.Scanner; public class Main { public static ArrayList<String> toWords(String content) { Scanner s = new Scanner(content); s.useDelimiter("\\s"); ArrayList<String> wordsArray = new ArrayList<>(); while (s.hasNext()) { wordsArray.add(s.next().toLowerCase()); }/*from ww w .j a v a2 s . co m*/ s.close(); return wordsArray; } }