proxy collection optimization for adding to the end of a list vs. adding elsewhere

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@610922 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Patrick Linskey 2008-01-10 20:37:36 +00:00
parent 0d3bc96fcb
commit 2933147f53
1 changed files with 5 additions and 1 deletions

View File

@ -38,6 +38,10 @@ public class ProxyCollections
*/ */
public static void beforeAdd(ProxyCollection coll, int index, Object value){ public static void beforeAdd(ProxyCollection coll, int index, Object value){
assertAllowedType(value, coll.getElementType()); assertAllowedType(value, coll.getElementType());
if (index == coll.size())
// optimize for adding to the end
beforeAdd(coll, value);
else
dirty(coll, true); dirty(coll, true);
} }