title: Index of geometric functions
body: <p>I am making a sort of command based application to draw geometric figures. So if a user enters something like <code>RECT 100, 50, 200, 120</code> I draw a rectangle at specified location on the drawing panel.</p>
  
  <p>So for this i need to map <code>RECT</code> to <code>g.drawRect(100, 50, 200, 120);</code> and all such similar functions to draw geometric figures.</p>
  
  <p>I will use a <strong>hash map</strong> for mapping, but i don't know how to build a array of functions in java. In C++ i have done this though.</p>
  
  <p>The key can be 'RECT' and the value the offset of the index.</p>
  
  <p>Please show me how can i index these functions. Or is there a still better way to address the primary concern?</p>