for (int i = 0; i < n; ++i)
{
Object o = list.get(i);
if (o instanceof DescriptionObject)
{
DescriptionObject desc = (DescriptionObject) o;
if (CommonUtil.equalsNull(desc.getName(), name))
return desc;
}
}
}
else
{
// For any other collection use an iterator to traverse it
for (Iterator it = c.iterator(); it.hasNext();)
{
Object o = it.next();
if (o instanceof DescriptionObject)
{
DescriptionObject desc = (DescriptionObject) o;
if (CommonUtil.equalsNull(desc.getName(), name))
return desc;
}
}
}
}