We would like to know how to delete duplicate lines from a String.
import java.util.HashSet; import java.util.Set; /*from ww w . j a va2 s . c o m*/ public class Main { public static void main(String[] args) { String input = "E,E,A,B,C,B,D,C"; Set<String> set = new HashSet<String>(); for (String s : input.split(",")) set.add(s); for (String s : set) System.out.println(s); } }