Simulation for repeatedly taking gloves until a matching pair is found I created the following code that simulates a person taking a random glove from a drawer until he/she gets a matching pair of gloves:

LinkedList&lt;String&gt; glovesList = new LinkedList&lt;String&gt;();
        LinkedList&lt;String&gt; matchList = new LinkedList&lt;String&gt;();
        Random rand = new Random();
        String[] glovesAvailable = {"red left", "red left", "red left", "red left", "red left",
                                    "red right", "red right", "red right", "red right", "red right",
                                    "yellow left", "yellow left", "yellow left", "yellow left",
                                    "yellow right", "yellow right", "yellow right", "yellow right",
                                    "green left", "green left", "green right", "green right"};

        // adding the gloves inside the list
        for(int i = 0; i &lt; glovesAvailable.length; i++) {
            glovesList.add(glovesAvailable[i]);
        }


        // taking out the gloves from the drawer
        while(glovesList.size() != 0) {
            int n = rand.nextInt(glovesList.size());
            System.out.println("Removed a " + glovesList.get(n));
            matchList.add(glovesList.remove(n));
            if((matchList.contains("red left") &amp;&amp; matchList.contains("red right")) ||
               (matchList.contains("yellow left") &amp;&amp; matchList.contains("yellow right")) ||
               (matchList.contains("green left") &amp;&amp; matchList.contains("green right"))) {
                System.out.println("Pair found!");
                break;
            }
        }

        // rechecking list if there are no more items
        System.out.println("Iterations till a matching pair is found: " + matchList.size());
        System.out.println("List of gloves taken out: " + matchList);
        System.out.println("Remaining gloves: " + glovesList.size());


The code works, but I am interested in making it more efficient. How can this code be improved?
Make the glove types an enum

public static enum GLOVE {
  RED_LEFT, RED_RIGHT,
  YELLOW_LEFT, YELLOW_RIGHT, 
  GREEN_LEFT, GREEN_RIGHT
}


this has several benefits:


with the current String solution, you can have a typo and you will not detect this until run time.  With an enum, the compiler checks values for you
the matchList.contains... if statement can be replaced by iteration on enum values 
checking equality on enum values is faster then String comparison


if you want an even better solution, you should make a Glove class with two attributes, color of type enum and hand of type enum.  then, implement equals() and hash() methods so you can put Glove instances in various Collections. The benefit if this solution is that it allows for future modification to Glove specifications (like, adding colors, adding material attribute, etc)