I have a text document that consists of a number of lines, each of which has a username, a comma, and a password. For example,
Joe, pass1
Sally, badpassword
Ahmed, goodpassword
And so forth.
I can read those lines into my program without any trouble. After that I want to separate them into an ArrayList. String.split() says it should separate them into an array. I need an ArrayList, and anyway the when I invoke split() my String is unchanged. So I don't know how to proceed.
This is where I think I am having a problem:
                while (true) {
                    if ((str = br1.readLine()) != null)
                        break;
                    out.println(str);
                    str.split(",");
                    userstr.add(str);
                }     
This is the whole class:
public BuggerGUI() {
    super("password");
    setLayout(new GridLayout(3, 4));
    userL = new JLabel("username");
    add(userL);
    userT = new JTextField(10);
    add(userT);
    passL = new JLabel("password: ");
    add(passL);
    passT = new JPasswordField(10);
    add(passT);
    blankL = new JLabel();
    add(blankL);
    loggin =  new JButton("login");
    add(loggin);
    handler Handler = new handler();
    userT.addActionListener(Handler);
    passT.addActionListener(Handler);
    loggin.addActionListener(Handler);
}
private class handler implements ActionListener {
    @Override
    public void actionPerformed(ActionEvent event) {
        String user = userT.getText();
        String pass = passT.getText();
        if (event.getSource() == loggin) {
            out.println("username: " + user);
            out.println("password: " + pass);
            try {
                ArrayList userstr = new ArrayList();
                FileReader fr1 = new FileReader("C:\\Users\\Owner\\Desktop\\passlist.txt");
                BufferedReader br1 = new BufferedReader(fr1);
                String str;
                while (true) {
                    if ((str = br1.readLine()) != null)
                        break;
                    out.println(str);
                    str.split(",");
                    userstr.add(str);
                }     
                for (int i = 0; i < userstr.size();)
                    if (userT.equals(userstr.get(i)))
                        out.print("cool");   
            } catch(IOException e) {
                System.out.println(ERROR);
            }
        }
    }
}
 
     
     
     
    