You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by David Brainard <sd...@gmail.com> on 2007/11/22 20:34:36 UTC
[TOMAHAWK] Minor optimization in StreamingAddResource class
Hi,
In the method mentioned below[1] rather than checking contains key the
whole code can be replaced with the code mentioned below[2] because this
will reduce the no of times contains is performed on the set.
[1]
private boolean checkAlreadyAdded(PositionedInfo info)
{
Long key = new Long(info.hashCode());
if (alreadySeenResources.contains(key))
{
return true;
}
alreadySeenResources.add(key);
return false;
}
[2]
private boolean checkAlreadyAdded(PositionedInfo info)
{
return !alreadySeenResources.add(new Long(info.hashCode()));
}
if it is appropriate pls comment and i'l open a issue in jira .
Regards,
David Brainard