title: Multiple arguments passed to function as union type
body: <p>I was looking to find a way to pass multiple enumerations to a method. One way to do it is </p>
  
  <pre><code>public enum State{
      A,
      B,
      C;
  }
  public void foo(State...states){
      // handle
  }
  
  // And call it like
  foo(State.A,State.B);
  </code></pre>
  
  <p>But I am curios if there is a way to use the idiom for multiple catch clauses</p>
  
  <pre><code>} catch (IOException | IllegalArgumentException e) {
  </code></pre>
  
  <p>So that you can call it like</p>
  
  <pre><code>foo(State.A | State.B)
  </code></pre>
  
  <p>I apologize for the title, but I do not know how to call this. Please suggest a better title.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I am not expecting an answer that the first version already does what I am asking and that the second construct is not possible .</p>
  
  <p>I want to know why it is not possible. If the syntactic of Java allows for the use of the | operator in the catch clauses, why it is not possible to use it in development.</p>