Java- Want to remove duplicates from list
<p>Hello guys should be an easy one.  I am looping through a set of beans and doing a check for something and adding to a list.  I only want to add one occurence of a particular item</p>

<pre><code> List&lt;HotPartsBean&gt; beans = hotPartsDAO.getDeletedHotPartsList(user);
    List&lt;EndItemBean&gt; endItemList = new ArrayList&lt;EndItemBean&gt;();
     for (HotPartsBean bean : beans)
            {
                       if (!bean.getEndItem().isActive())
                {
                    endItemList.add(bean.getEndItem());
                }
            }
</code></pre>

<p>In the list I get for example 
"test"
"test"
"test"
"hello"</p>

<p>I just want 1 "test"</p>

<p>Thanks for the tip.....if I were to use a set...How would I modify this so that I can add the components of that set to this below:</p>

<p>This here is how its currently being passed over  <code>List&lt;EndItemBean&gt; list</code></p>

<pre><code>    protected final void buildEndItemFilterList( Action action, HotPartsDAO dao, List&lt;EndItemBean&gt; list )

    throws SQLException
{
    List&lt;EndItemBean&gt; endItems = dao.getAllEndItems( false );
    EndItemBean endItem;

    for (EndItemBean e: list )
    {
         endItem = dao.getEndItemById(e.getId());
         endItems.add(endItem);
    }

    Collections.sort( endItems );
    action.setRequestAttribute("endItems", endItems );
  }
</code></pre>
