Tuesday, February 10, 2015

De Dup. java in a programe



DeDup.java

public class DeDup
 { 
    public static void main(String[] args)
   {
        SET distinct = new SET();
        while (!StdIn.isEmpty())
   {
            String key = StdIn.readString();
            if (!distinct.contains(key))
   {
                distinct.add(key);
                StdOut.println(key);
            }
        }
    }
}

No comments:

Post a Comment