title: java: create a lookup table using hashmap or some other java collection?
body: <p><a href="https://stackoverflow.com/q/14236601/1503130">Extending this question</a>, I have accepted an answer which says <strong>use lookup table or hashmap</strong> for this case as it would be a better <strong>construct to handle multiple conditions</strong>.</p>
  
  <p>Current construct.</p>
  
  <blockquote>
    <p><strong>Class to store messages.</strong></p>
  </blockquote>
  
  <pre><code>    public class ProgressMessages 
      {
       public static String msg1="Welcome here .....";
       .
       .
       .
       //around 100 more similar static variables.
      }
  </code></pre>
  
  <blockquote>
    <p><strong>Condition and Display the proper message from the above class.</strong></p>
  </blockquote>
  
  <pre><code>    int x=calculatedVal1(m,n); 
      int y=calculatedVal2(o,q);
  
      SimpleDateFormat formater=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      Date d=new Date();
      String s=formater.format(d);
  
      try {
            long d1 = formater.parse("2013-01-10 13:53:01").getTime();
            long d2=formater.parse(s).getTime();
            totaldays=Math.abs((d1-d2)/(1000*60*60*24));
           } catch (ParseException e) {
              e.printStackTrace();
           }
  
      if(totaldays&lt;7&amp;&amp;x&lt;20)
       {
        System.out.println("my message...1"+ProgressMessages.msg1); 
       }
  
      else if(totaldays&lt;7&amp;&amp;x&gt;10&amp;&amp;y&lt;20)
      {
        System.out.println("my message...2"+ProgressMessages.msg2);
      }   
      ....
      //obvioulsy 100 more else-if's to display 100 messages.
  </code></pre>
  
  <blockquote>
    <p>I actually would like to know how would a look-up table help in this
    case?</p>
  </blockquote>
  
  <p><strong>How should it be implemented in java Hashmap/Hashtable etc, What would be advantageous how?</strong></p>
  
  <p>----Edit---</p>
  
  <p>I am going by @assylias anwer as it is more clean to apply . But If I use Enums then I have got a fix. </p>
  
  <p>To describe the big picture...</p>
  
  <p>i.e. List of messages is like...</p>
  
  <p>1) "Welcome," + nameOfUser+"your success rate is"+ succssRate +"%"+ earlier it was +earlier +"%".</p>
  
  <p>2) "Oh yes.."+ succssRate +"%"+ improved from +earlier +"%".</p>
  
  <p>3.) "Now you should focus on "+exerCiseName.</p>
  
  <p>How could I do this using Enumeration as it has fixed String data. Could I make different constructors? How any example with the edit code to assylas answer?</p>