checking if a value is one of many constants
<p>In Python, you can:</p>

<pre><code>if error_code in (1213,1205,1317,2006,2013):
    ...
</code></pre>

<p>How can you concisely do the same kind of check - seeing if an int is one of many choices - in Java?</p>

<p>UPDATE: the solution I adopted:</p>

<pre><code>private static final Set&lt;Integer&gt; MySQLRetryCodes = 
    Collections.unmodifiableSet(new HashSet&lt;Integer&gt;(
         Arrays.asList(
            1205, // lock timeout
            1213, // deadlock
            1317,2006,2013 // variations on losing connection to server
         )));
</code></pre>

<p>and then later:</p>

<pre><code>if(MySQLRetryCodes.contains(sqlError.getErrorCode()) {
    ...
</code></pre>
