Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions client/src/com/aerospike/client/lua/LuaList.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,16 @@ public void concat(LuaList list2) {
}

public LuaList merge(LuaList list2) {
List<LuaValue> target = new ArrayList<LuaValue>(this.list);
target.addAll(list2.list);
// Pre-size to combined capacity to avoid reallocation when adding
int size1 = this.list.size();
int size2 = list2.list.size();
List<LuaValue> target = new ArrayList<LuaValue>(size1 + size2);
if (size1 > 0) {
target.addAll(this.list);
}
if (size2 > 0) {
target.addAll(list2.list);
}
return new LuaList(instance, target);
}

Expand Down