title: How to restrict status transition values to only valid values in Java?
body: <p>I have to implement a status transition validation, like:</p>
  
  <pre><code>'P' -&gt; 'W' -&gt; 'M' -&gt; 'F' -&gt; 'G'
  'P' -&gt; 'I' -&gt; 'B' -&gt; 'M' -&gt; 'F' -&gt; 'G'
  </code></pre>
  
  <p>where <code>"-&gt;"</code> denotes "can move to"</p>
  
  <p>In short, a particular status can move to only certain status, but not other status. As in above example, P can move to W or I but not any other status.</p>
  
  <p>Note: There are finite number of status in the system.</p>
  
  <p>I have read about Strategy pattern, but I did not feel this particular problem suited to it.
  What will be best way to implement this in Java 8 ?</p>