title: Removing Object of ArrayList by using it's unique ID
body: <p>I am having problems with the functions of the <code>ArrayList</code>. I'm trying to remove objects of an ArrayList by specifying their <code>ID</code>. I have a <code>createEmployee</code> method in my <code>Main</code> class:</p>
  
  <pre><code>public void createEmployee(){
      String typeofemployee = sc.nextLine();
  
      UUID uniqueID = UUID.randomUUID();
      String x = "" + uniqueID;
      System.out.println("The new ID of the " + typeofemployee + " is: " + uniqueID + ".");
  
      System.out.println("What's the name of the new " + typeofemployee + "?");
      name = sc.nextLine();
      System.out.println("What's the salary of the new " + typeofemployee + "?");
      salary = sc.nextDouble();
      Employee employee = new Employee(x, name, salary);
  
      switch (typeofemployee) {
  
          case "Employee":
              reusaxcorp.registerEmployee(employee);
              break;
  
          // other cases
      }
  }
  </code></pre>
  
  <p>And I have an <code>ArrayList</code>, to which I add employees by registering them with the following method (down below there's the <code>removeEmployee</code> method).</p>
  
  <pre><code>public class ReusaxCorp extends Main {
  
  Scanner input;
  ArrayList&lt;Employee&gt; employees = new ArrayList&lt;Employee&gt;();
  final String END_OF_LINE = System.lineSeparator();
  
  public void registerEmployee(Employee employee){
      employees.add(employee);
  }
  
  public void retrieveEmployee() {
      for(Employee employee: employees){
          System.out.println("ID: " + employee.ID + END_OF_LINE + "Name: " + employee.name + END_OF_LINE + "Salary: " + employee.grossSalary);
          System.out.println(); // an empty line for each employee
      }
  }
  
  public void removeEmployee(){
      employees.remove(0); 
      /* I also tried this, but it doesn't work either
      Iterator&lt;Employee&gt; iter = employees.iterator();
      while(iter.hasNext()){
          for (int i = 0; i &lt; employees.size(); i++) {
              System.out.println("Which eployee do you want to remove? Type in his/her ID. ");
              int number = input.nextInt();
              Employee employee = iter.next();
              if (employees.equals(number)) {
                  employees.remove(i);
              }
          }
      }
      */
  }
  </code></pre>
  
  <p>The only way I know of is just to write <code>employees.remove(index)</code> and removing an employee by specifying his index. <strong>So I want to know if it's possible to remove an employee by specifying his unique ID.</strong> Thank you.</p>