public static Map<String, List<String>> readWords(File f) {
        Map<String, List<String>> m = new HashMap<String, List<String>>();
        Scanner s = null;
        try {
            s = new Scanner(f);
            while (s.hasNext()) {
                String word = s.next();
                String alpha = sortLetters(word);
                List<String> l = getWordsList(m, alpha);
                l.add(word);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (NullPointerException e) {
            e.printStackTrace();
        } catch (Exception e) {
            System.err.println(e);
            System.exit(1);
        } finally {
            if (s != null) {
                s.close();
            }
        }
        return m;
    }