title: Complex if/else logic in java with multiple variables
body: <p>There can be two types of groups- private and public. Each group can have members in it. I have three parameters id, includePrivate, includePublic to be passed into a method to return the groups as per the rules below. 
  For eg. </p>
  
  <pre><code>public List&lt;Group&gt; getListofGroups(String id, Boolean isPrivate, Boolean   isPublic){}
  </code></pre>
  
  <ol>
  <li>All groups {}</li>
  <li>all private groups {"includePrivate": true}</li>
  <li>all public groups {"includePublic": true}</li>
  <li>all private groups with membership  {"id":"id1", "includePrivate": true }</li>
  <li>all private groups with membership + all public groups {"id":"id1", "includePrivate": true, "includePublic": true }</li>
  </ol>
  
  <p>What is the best way to implement this complex if/else logic? Is it a good option to create a rules engine just for this api?</p>
  
  <pre><code> For eg. if(isPrivate &amp;&amp; isPublic &amp;&amp; id=!null) {
      return publicAndPrivateWIthMembership();
  } else if(isPrivate &amp;&amp; id=!null ) {
      return privateGroupsWithMembership();
  } else if((isPublic &amp;&amp; !isPrivate) ||(isPublic &amp;&amp; isPrivate == null) ) {
      return allPublicGroups();
  } else if((isPrivate &amp;&amp; !isPublic) ||(isPrivate &amp;&amp; isPublic == null) ) {
      return allPrivateGroups();
  }........
  </code></pre>