title: Using an enum in Java as an alternative to a small database
body: <p>I have a java application which uses a class "Country". The business logic associates each country in the world with:</p>
  
  <ol>
  <li>An iso code.</li>
  <li>A telephone country calling code</li>
  <li>A list of TZ database timezone ids suitable for that country</li>
  </ol>
  
  <p>Normally, this is data is perfect for a database. However, given the fact that this data is quite stable (sure, it changes now and then, but it is normally not used to perform create/update/delete operations on those records) I was thinking about maybe putting the information in an enumeration like this:</p>
  
  <pre><code>public enum Country
  {
  
     US(1,new String[]{"America\New York","America\California",...}),
  
     ...
  
     NL(31, new String[]{"Europe\Amsterdam"});
  
      ...
  
      public Country(int telephoneCode, String[] timezoneIds)
      {
         ...
      }
  }
  </code></pre>
  
  <p>Possible advantages to this approach:</p>
  
  <ol>
  <li>Data is directly accesible from java source code, so there is no delay with doing database queries.</li>
  <li>No need to set-up and maintain a database file somewhere (which is a big deal for me, because I'm not familiar with JDBC yet)</li>
  </ol>
  
  <p>The disadvantages could be: </p>
  
  <ol>
  <li>Data is "hidden" inside the source code and is not updated automatically if politics change.</li>
  <li>Code must be redistributed if enums change. (See <a href="https://stackoverflow.com/questions/24680744/when-to-use-an-enum-or-a-small-table-in-a-relational-database">this question</a>.)</li>
  <li><strong>How well is the performance of "big" enums (more than 200 possible values) compared to database queries to get specific information?</strong></li>
  </ol>
  
  <p>I would like to ask about the bolded question (disadvantage #3), but any comments regarding the bigger picture are welcome.</p>
  
  <p>I am aware of the Locale class in java which can be used to get a list of all possible countries known in the java system. Unfortunately, telephone and timezone information is not available. My intent is too merge this data into one enumeration. Is this practice considered to be a plausible alternative or hackity anti pattern? </p>