title: How do I loop through an enum in Java?
body: <p>Let's say I have an enum like so:</p>
  
  <pre><code>public enum Numbers {
      ONE("Uno "),
      TWO("Dos "),
      THREE("Tres ");
  }
  
  private final String spanishName;
  
  Numbers(String spanishName) {
      this.spanishName = spanishName;
  }
  
  public String getSpanishName() {
      return spanishName;
  }
  </code></pre>
  
  <p>Now I have a method that outputs a given variable. </p>
  
  <pre><code>public void output(String value) {
      printStream.print(value);
  }
  </code></pre>
  
  <p>I want to use a <code>for</code> loop to output all the values in the enum. Something along the lines of this:</p>
  
  <pre><code>for(/*each element in the enum*/) {
      //output the corresponding spanish name
  }
  </code></pre>
  
  <p>Ultimate I want the final output to be <code>Uno Dos Tres</code>. How can I do this using enums and a for loop?</p>