title: Multiple boolean variables as function parameters
body: <p>I have plenty of boolean variables in my code and I want to pass them into a function.</p>
  
  <pre><code>public myClass {
  
           boolean isA, isB, isC, isD, isE, isF, isG;
  
           // loop to set booleans true or false
  
           String str = addString(isA, isB, isC, isD, isE, isF, isG);
      }
  
  private String addString(boolean isA, boolean isB, boolean isC, boolean isE, boolean isF, boolean isG) { 
   //code
  }
  </code></pre>
  
  <p>The way the program works it will be 2-3 variables true at any point. I want to avoid all those booleans as parameters so I'm considering to pass the true ones into an ArrayList, as : </p>
  
  <pre><code>public myClass {
  
           boolean isA, isB, isC, isD, isE, isF, isG;
  
           // loop to set booleans true or false
  
           ArrayList&lt;boolean&gt; list = new ArrayList();
  
           if(isA) list.add(isA);
           // same check for every variable
  
           String str = addString(list);
      }
  
  private String addString(ArrayList&lt;boolean&gt;list) { 
        //code
  }
  </code></pre>
  
  <p>Is there any better way? I want to know which boolean is passed each time.</p>