Java Vector removeDuplicateDomains(Vector s)

Here you can find the source of removeDuplicateDomains(Vector s)

Description

remove Duplicate Domains

License

Apache License

Declaration

public static Vector removeDuplicateDomains(Vector s) 

Method Source Code

//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;
    }
}

Related

  1. getNonNullVectors(int[][] usageM)
  2. hasDuplicates(Vector v)
  3. isContained(Object obj, Vector vect)
  4. median(double[] vector)
  5. normVector(List v1)
  6. removeDuplicates(Vector s)
  7. shiftIndicies(List list, int[] indicies, int shiftVector)
  8. vector(final float[] p2, final float[] p1)
  9. Vector2fMult(float[] a, float[] b, float[] dest)