I have one Arraylist of String and I have added Some Duplicate Value in that. and i just wanna remove that Duplicate value So how to remove it.
Here Example I got o
public static void main(String[] args) { @SuppressWarnings("serial") List lst = new ArrayList() { @Override public boolean add(Object e) { if(!contains(e)) return super.add(e); else return false; } }; lst.add("ABC"); lst.add("ABC"); lst.add("ABCD"); lst.add("ABCD"); lst.add("ABCE"); System.out.println(lst); }
This is the better way