title: How to know which element matched in java-8 anymatch?
body: <p>Assuming I have an enum </p>
  
  <pre><code>enum Country {
      China, 
      USA, 
      Others
  }
  </code></pre>
  
  <p>Say I have a 
  <code>list1 = ["China", "Shanghai", "Beijing"]</code> and a check for <code>isChina</code>, if true, then return Country.China. </p>
  
  <p><code>list2 = ["USA", "Dallas", "Seattle"]</code> and a method checks for <code>isUSA</code>, if true then return Country.USA. </p>
  
  <p>If USA or China is missing from the list, then return Country.Others.</p>
  
  <p>Assumption: A list will always contain only 1 country followed by cities in that country.</p>
  
  <p>[Edit] Do not assume, country would be first element in the array.</p>
  
  <p>While I find it extremely easy to implement in Java-7, I am not sure of the most elegant way to do this using streams</p>
  
  <pre><code>for (String str: list) {
     if (str.equals("China")) {
         return Country.China  
     } 
     if (str.equals("USA")) {
         return Country.USA; 
     }
  }
  return Country.Other;
  </code></pre>
  
  <p>I am looking for a clean implementation using Streams.</p>