Java 7 has now made it easier to do what I wrote here, longer ago now than I care to remember. You can get a Collection of String from a file pretty easily. The source code can be downloaded HERE. Of course, if you're still using < Java 7, you can use the earlier code.


import java.nio.charset.Charset;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;

import java.util.List;

public class StringListDemo {
    public static void main(String[] args) {
        try {
            List<String> strings = Files.readAllLines(FileSystems.getDefault()
        } catch (IOException e) {


Please support this site using the button below: