I looked at
org.ofbiz.entity.util.EntityUtil.getFieldListFromEntityList(List<GenericValue>,
String, boolean)
I think I used the concept, but am unsure how to generalize so I could
pass in a Map fields to check uniqueness by.
List<GenericValue> filteredList = FastList.newInstance();
Set distinctSet = FastSet.newInstance();
String filterId = null;
for (GenericValue gv : listWithDuplicates)
{
filterId = gv.getString("someId");
if (!distinctSet.contains(filterId))
{
distinctSet.add(filterId);
filteredList.add(gv);
}
}
listWithDuplicates.clear();
listWithDuplicates.addAll(filteredList);
Scott Gray wrote:
> Hi Stephen,
>
> Depending on what you plan on doing with the results you may find the
> getFieldListFromEntityList(List<GenericValue>, String, boolean) method
> useful.
>
> Regards
> Scott
>
> HotWax Media
>
http://www.hotwaxmedia.com>
> On 19/11/2009, at 2:17 AM, Stephen Rufle wrote:
>
>> I have a query that I think require that I join in such a way that
>> the resultset has multiple rows with the same id value.
>>
>> I would like to do something similar to
>> org.ofbiz.entity.util.EntityUtil.filterByAnd(List<T>, Map<String, ?
>> extends Object>)
>>
>> but maybe called
>> EntityUtil.filterDuplicates(List<T> values, Map<String, ? extends
>> Object> fields)
>>
>> Does this type of functionality already exist in ofbiz?
>>
>