title: Filter unique objects from an ArrayList based on property value of the contained object
body: <p>How will I filter unique object from an arraylist.</p>
  
  <pre><code>List&lt;LabelValue&gt; uniqueCityListBasedState = new ArrayList&lt;LabelValue&gt;();
  for (LabelValue city : cityListBasedState) {
      if (!uniqueCityListBasedState.contains(city)) {
          uniqueCityListBasedState.add(city);
      }
  }
  </code></pre>
  
  <p>This is my code. But the problem is that I need to filter not on the object but on the value of a property inside that object. In this case, I need to exclude the objects that has the name.</p>
  
  <p>That is <code>city.getName()</code></p>