package eecs1022; import java.io.File; import java.io.FileNotFoundException; import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Duplicates { public static void main(String[] args) throws FileNotFoundException { String name = "Lab1.ePost"; File file = new File(name); Scanner input = new Scanner(file); Set entries = new HashSet(); while (input.hasNextLine()) { String line = input.nextLine(); String[] part = line.split("\\s+"); String ppy = part[0]; boolean duplicate = !entries.add(ppy); if (duplicate) { System.out.println(ppy); } } input.close(); } }