title: Initialize Runnable Array of Lambdas(with string arg and returns a boolean) and Call Index
body: <p>I was able to get this working with lambda's returning void and taking in 0 args using a hash table, see here -> <a href="https://stackoverflow.com/questions/43977026/create-lambda-two-dimensional-array">Create lambda two dimensional array</a></p>
  
  <p>Now, I'm trying to create a <code>Runnable[]</code> array, with lambda's in the index, and each lambda takes a String argument and returns a boolean.</p>
  
  <p>Here is the code...</p>
  
  <pre><code>public class testLambdaWithPrimitiveType {
      private final String[] numArray = {"One", "Two", "Three"};
      private boolean numFound = false;
  
      testLambdaWithPrimitiveType(String num){
          setNumFound(num);
      }
  
      private void setNumFound(String num){
          Runnable[] runnableNumArray = {
                  () -&gt; isStringOne(num),
                  () -&gt; isStringTwo(num),
                  () -&gt; isStringThree(num)
          };
  
          for (int numChecked = 0; numChecked &lt; runnableNumArray.length; numChecked++){
              if (runnableNumArray[numChecked].run(num)){
                  this.numFound = true;
              }
          }
      }
  
      private boolean isNumFound(){return this.numFound;}
  
      private boolean isStringOne(String num){
          return num.equals(numArray[0]);
      }
  
      private boolean isStringTwo(String num){
          return num.equals(numArray[1]);
      }
  
      private boolean isStringThree(String num){
          return num.equals(numArray[2]);
      }
  
      public static void main(String[] args) {
          testLambdaWithPrimitiveType objectOne = new testLambdaWithPrimitiveType("One");
          testLambdaWithPrimitiveType objectTwo = new testLambdaWithPrimitiveType("Two");
          testLambdaWithPrimitiveType objectThree = new testLambdaWithPrimitiveType("Three");
          testLambdaWithPrimitiveType objectFour = new testLambdaWithPrimitiveType("Four");
  
          System.out.println(objectFour.isNumFound()); // false
          System.out.println(objectThree.isNumFound()); // true
          System.out.println(objectTwo.isNumFound()); // true
          System.out.println(objectOne.isNumFound()); // true
      }
  }
  </code></pre>
  
  <p>It looks like the array gets initialized correctly, but when I try to call on the index <code>if (runnableNumArray[numChecked].run(num)){</code>, I get a compile error. Any idea why this is happening?</p>