Here you can find the source of readAll(String fileName)
public static Set<String> readAll(String fileName) throws IOException
//package com.java2s; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.HashSet; import java.util.Set; public class Main { public static Set<String> readAll(String fileName) throws IOException { BufferedReader reader = new BufferedReader(new FileReader(fileName)); Set<String> s = new HashSet<String>(); String line;/* w ww . java 2 s .c o m*/ while ((line = reader.readLine()) != null) { if (!"".equals(line)) { s.add(line); } } return s; } }