Here you can find the source of removeDuplicateDomains(Vector s)
public static Vector removeDuplicateDomains(Vector s)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static Vector removeDuplicateDomains(Vector s) { int i = 0; int j = 0; boolean duplicates = false; String str1 = ""; String str2 = ""; Vector v = new Vector(); for (i = 0; i < s.size(); i++) { duplicates = false;// w w w .j av a2 s . c om for (j = (i + 1); j < s.size(); j++) { str1 = ""; str2 = ""; str1 = s.elementAt(i).toString().trim(); str2 = s.elementAt(j).toString().trim(); if (str1.indexOf('@') > -1) { str1 = str1.substring(str1.indexOf('@')); } if (str2.indexOf('@') > -1) { str2 = str2.substring(str2.indexOf('@')); } if (str1.equalsIgnoreCase(str2)) { duplicates = true; } } if (duplicates == false) { v.addElement(s.elementAt(i).toString().trim()); } } return v; } }