title: How to make string get elements from an array based on the combobox array
body: <p>I miss something and I will appreciate your help
  I have this array for a combobox</p>
  
  <pre><code>String array [] = {"aa", "bb", "cc"};
  </code></pre>
  
  <p>and I have this for loop to run all over the array</p>
  
  <pre><code>for(String s: array) {
      if(s.equals(array[0]) {
          //do something
      }
  }
  </code></pre>
  
  <p>Now what I need is that, I need the "do something" to happen to each element in the array only when the element is selected by the combobox, my array is so long and I can't write if statement for each element in the array.</p>
  
  <p>What I want is something like that</p>
  
  <pre><code>for(String s : array) { 
    if(s equals the array elements) {
        substring the first index of each element
        print s
        so result let's say will be like this
        a ----&gt; if only element a is selected
        b ----&gt; if only element b is seleceted
        etc ...
    }
  }
  </code></pre>