title: Matching two ArrayList value in android
body: <p>I have two <code>ArrayList</code>. First contains class name such as Ab,BB,CC and second <code>ArrayList</code> contains class name and name. I want that when I select the class name from first <code>ArrayList</code>, then show only name which name is match first <code>ArrayList</code> name. How is it possible? </p>
  
  <p>Here are some code snippets:</p>
  
  <pre><code>JSONArray array3 = object.getJSONArray("class");
  for(int x = 0; x&lt;array3.length(); x++){
      JSONObject object1=array3.getJSONObject(x);
      c = object1.getString("class");
      classItem.add(c);
  } 
  </code></pre>
  
  <hr>
  
  <pre><code>JSONArray array4 = object.getJSONArray("subclass");
  for(int z = 0; z&lt;array4.length(); z++){
      JSONObject object1 = array4.getJSONObject(z);
      String name = object1.getString("Name");
      String cname = object1.getString("class");
      subclassitm.add(name);
  } 
  </code></pre>
  
  <p><code>array3</code> contains only class name and <code>array4</code> contains name and class name. I want when I select class from <code>array3</code> then only show name in <code>array4</code>.</p>