public ArrayList<String> dictionary()
    {
        ArrayList<String> a = new ArrayList<>();
        try { 
            reader = new BufferedReader(new FileReader(file)); 
            String text = null; 

            // repeat until all lines is read 
            while ((text = reader.readLine()) != null) { 
                words.add(contents.append(text) 
                    .append(System.getProperty( 
                            "line.separator")));
                contents =  new StringBuffer();        
            } 
        } catch (FileNotFoundException e) { 
            e.printStackTrace(); 
        } catch (IOException e) { 
            e.printStackTrace(); 
        } finally { 
            try { 
                if (reader != null) { 
                    reader.close(); 
                } 
            } catch (IOException e) { 
                e.printStackTrace(); 
            } 
        } 

        for (StringBuffer b: words)
            a.add(b.toString());
        return a;    
    }