title: How to store Java constants for use in building key value combinations
body: <p>Let's say I want to store potential keys and potential values for those keys as constants.  How can I achieve this?  Or should I avoid it altogether?  </p>
  
  <p>This is the aproach that I thought of myself, but as you'll be able to see, it has an obvious downfall.</p>
  
  <pre><code>public static class Foo { 
  
      public static final String KEY = "foo" ; 
  
      public static class Values { 
  
          public static final String BAR = "bar" ; 
          public static final String HEY = "hey" ; 
  
      }
  
  }
  
  public static class Another { 
  
      public static final String KEY = "another" ; 
  
      public static class Values { 
  
          public static final String ONE = "1" ; 
          public static final String TWO = "two" ;
          public static final String THREE = "THREE" ;
  
      }
  
  }
  </code></pre>
  
  <p>Which allows me to access these keys like so </p>
  
  <pre><code>miscellaneousMethod( Foo.KEY, Foo.Values.BAR )
  miscellaneousMethod( Another.KEY, Another.Values.TWO )
  </code></pre>
  
  <p>However, I don't exactly want to write a separate static inner class for each key / possible-values pair.  </p>
  
  <p><strong>Is there a better way to store key value pairs as constants?</strong> </p>
  
  <p>I want to store them as constants for later comparison with generated hashmaps.  So that I can ask stuff like this:</p>
  
  <p><code>if( map.get( Foo.KEY ).equals( Foo.Values.HEY ) ) { /* do stuff */ }</code></p>