title: Duplicate Elimination Using Sets in Java
body: <p>Write a program that reads in a series of first names and eliminates duplicates by storing them in a Set. Allow the user to search for a first name.</p>
  
  <p>(Trust me, I am not taking any Java classes. So, not my homework).</p>
  
  <p>My issue is to implement this: <strong>Allow the user to search for a first name.</strong></p>
  
  <p>Everything else works, just the search feature. </p>
  
  <p><em>My Code so far....</em></p>
  
  <pre><code>package com.Sets;
  
  import java.util.Arrays;
  import java.util.Collection;
  import java.util.Collections;
  import java.util.HashSet;
  import java.util.List;
  import java.util.Scanner;
  import java.util.Set;
  
  public class DuplicateElimination {
  
      public static void main(String[] args) {
  
          // Write a program thats ask for first names and store it in an array.
  
          String fName;
  
          Scanner input = new Scanner(System.in);
          String[] names = new String[10];
  
          for (int i = 0; i &lt; names.length; i++) {
              System.out.println("Enter First Name: ");
              names[i] = input.nextLine();
          }
          // Printout that array as a list.
          List&lt;String&gt; list = Arrays.asList(names);
  
          // Initial Array Elements
          System.out.printf("%s ", list);
          System.out.println();
  
          // Calling removeDuplicates method
          removeDuplicates(list);
  
      }
  
      // Make a method called removeDuplicates.
      private static void removeDuplicates(Collection&lt;String&gt; values) {
  
          // Implement a Hashset in it.
          Set&lt;String&gt; set = new HashSet&lt;String&gt;(values);
  
          // Printout a non-duplicate list of elements.
          for (String value : set) {
              System.out.printf("%s ", value);
          }
  
          System.out.println();
  
      }
  
      // Make a method to search for a first name.
      public static void searchForName(Collection&lt;String&gt; names) {
  
          String someName;
  
          Set&lt;String&gt; set = new HashSet&lt;String&gt;(names);
          Scanner input = new Scanner(System.in);
  
  
          for (int i = 0; i &lt;= 10; i++) {
              System.out.println("Search this name: ");
              someName = input.nextLine();
          }
  
          if (someName ) {
  
          } else {
  
          }
      }
  
  }
  </code></pre>
  
  <p>I don't feel confident about my searchForName method... can someone give an idea on how I could make this work?</p>