title: Generic interface in java with WildCard
body: <p>I am bit confused mixing Java generics interfaces and type wildcard. 
  I am trying to implement a generic way to pass  a list of options to a method where the type of the option is unknown at compile type. </p>
  
  <p>I did in the following way, but I get an error at compile time. </p>
  
  <p>Generic Interface : </p>
  
  <pre><code>public interface IOption&lt;T&gt; { 
      public T getOption();
  }
  </code></pre>
  
  <p>This method should take in input a list of options of unknown type, so I used a wild card.</p>
  
  <pre><code>public interface IAction {
      boolean do(Iterable&lt;IOption&lt;?&gt;&gt; options);
  }
  </code></pre>
  
  <p>The I created the following list of boolean options : </p>
  
  <pre><code>    IOption&lt;Boolean&gt; option =  new IOption&lt;Boolean&gt;(){
              @Override
              public Boolean getOption() {
                  return new Boolean(doEnable);
              }           
          };
      Iterable&lt;IProjectStateOption&lt;Boolean&gt;&gt; options = 
                     Collections.singletonList(option);
  </code></pre>
  
  <p>but when the method <code>do</code> is called I get the following error : </p>
  
  <pre><code>The method do( Iterable&lt;IOption&lt;?&gt;&gt;) in the type IAction is not applicable for 
  the arguments (Iterable&lt;IOption&lt;Boolean&gt;&gt;)
  </code></pre>