-1
単語のファイルを文字列配列に変換しました。私は何とかArrayを単語長のリストに変換して検索可能にする必要があります。言い換えれば、私は単語の長さ(例えば5)を入力し、単語の長さが5である単語だけを提示できる必要があります。助けて?単語の辞書:単語の長さごとに各要素をスキャンして検索可能にする必要があります
public static void main(String[] args) throws IOException {
String token1 = "";
Scanner scan = new Scanner(new File("No.txt"));
List<String> temps = new ArrayList<String>();
while (scan.hasNext()){
token1 = scan.next();
temps.add(token1);
}
scan.close();
String[] tempsArray = temps.toArray(new String[0]);
for (String s : tempsArray) {
ループ、長さを比較しますか? – tnw
[Google Guavaのマルチマップ](https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap)をご覧ください。 'Multimap'を使って単語を長さで集めることができます。 –
Thomas
私の答えに関するコメント/フィードバック?助けてくれますか?あなたに受け入れられるように何かを加えることができますか? – GhostCat