このArrayListの値を配列に変換するにはどうすればよいですか?つまり、次のようになります。
String[] textfile = ... ;
値は文字列(テキストファイル内の単語)であり、1000を超える単語があります。この場合、words.add( "")を1000回実行することはできません。次に、このリストを配列に入れるにはどうすればよいですか?
public static void main(String[]args) throws IOException
{
Scanner scan = new Scanner(System.in);
String stringSearch = scan.nextLine();
List<String> words = new ArrayList<String>(); //convert to array
BufferedReader reader = new BufferedReader(new FileReader("File1.txt"));
String line;
while ((line = reader.readLine()) != null) {
words.add(line);
}