title: Are Java varargs received in the same order in which they were given?
body: <p>I can't find any documentation on this issue.</p>
  
  <p>In some <code>Lists</code> and <code>Maps</code>, the order of the elements is random and is not the same order in which they were added to the list / map. Is that true about var args, or are they received in the same order in which they were sent?</p>
  
  <p>E.g, I have a form validation method, which takes a field name and a vararg list of rules. If I supply the rules: <code>Rules.INT, Rules.MAX.arg(100)</code>, then I would want the <code>Rules.INT</code> rule to be checked first, before the <code>Rules.MAX</code> rule is checked, because <code>Rules.MAX</code> assumes that the given value is a proper integer. Hence if <code>Rules.INT</code> fails, then <code>Rules.MAX</code> would not be called - however if the varargs are received in a random order, then <code>Rules.MAX</code> may get called before <code>Rules.INT</code> anyway, and could then throw up an exception if the value is not an integer, which is what I don't want.</p>
  
  <p>Edit: Here's my method with the var args, for clarification:</p>
  
  <pre><code>public boolean validate(String name, Rule... rules)
  {
     String value = getValue(name);
     for (Rule rule : rules)
     {
       if (! rule.match(value) )
          return false;
     }
     return true;
  }
  </code></pre>
  
  <p>Now, if I called this method by: <code>validate("age", Rule.INT, Rule.MAX.arg(100) )</code>, can I be sure that <code>Rule.INT</code> will be iterated / checked before <code>Rule.MAX</code> in the <code>validate()</code> method?</p>