title: Java Enum or HashMap for static values
body: <p>I am generating a CSV file along with CTL file for use with <code>sqlldr</code>. The CTL file needs to know the names of the columns that I want to load, and my CSV file needs to know the default values of these fields.</p>
  
  <pre><code>/*
   * Models a line in the CSV file
   */
  public class CSVRecord {
    ...
  }
  
  /*
   * Models the CTL file
   */
  public class ControlFile {
      ...
  }
  </code></pre>
  
  <p>These 2 classes are initialised and used inside <code>CSVExportFile</code> and I have 2 approaches:</p>
  
  <h2>1. Enum</h2>
  
  <pre><code>public enum Columns {
      ID("1"),
      NAME("Bob"),
      ...
  }
  </code></pre>
  
  <h2>2. HashMap</h2>
  
  <pre><code>public class CSVExportFile {
      private HashMap&lt;String, String&gt; columns;
  
      public CSVExportFile() {
          columns = new HashMap&lt;String, String&gt;();
          columns.put("ID", "1");
          columns.put("Name", "Bob");
          ...
      }
  }
  </code></pre>
  
  <hr>
  
  <p>The <code>HashMap</code> reduces the scope of the columns and will mean that they can only be used inside <code>CSVExportFile</code>. I do not plan to extend this functionality (all classes will be <code>final</code>), so I'm not sure that my <code>enum</code> gains me anything.</p>
  
  <p>What are the arguments for/against each approach, is this a specific case where one is superior, or is one way always superior?</p>