title: Java: Getting an array of ENUM elements
body: <p>Is there a better way of creating arrays from elements of an enum:</p>
  
  <pre><code>    public static enum LOGICAL {
          AND ("&amp;", "AND"),
          OR ("||", "OR");
  
          public final String symbol;
          public final String label;
  
          LOGICAL(String symbol, String label) {
              this.symbol=symbol;
              this.label=label;
          }
      }
  
      public static final String[] LOGICAL_NAMES = new String[LOGICAL.values().length];
      static{
          for(int i=0; i&lt;LOGICAL.values().length; i++)
              LOGICAL_NAMES[i]=LOGICAL.values()[i].symbol;
      }
  
      public static final String[] LOGICAL_LABELS = new String[LOGICAL.values().length];
      static{
          for(int i=0; i&lt;LOGICAL.values().length; i++)
              LOGICAL_LABELS[i]=LOGICAL.values()[i].label;
      }
  </code></pre>