Reverse order in addAll(List,Cons).

This causes the elements of the list to match the original order they were
added to the cons list (which stores elements "backwards").

This order matters for joins, as Ray discovered.
This commit is contained in:
Michael Bayne
2013-10-10 22:06:34 +00:00
parent 1547c7d44c
commit ca4ec1f4d3
@@ -683,11 +683,13 @@ public class Query<T extends PersistentRecord>
return new Cons<T>(head, tail);
}
// note that because new elements are prepended to the cons list, we turn them into a Java list
// in reverse order, which matches the original order in which they were "appended"
protected static void addAll (List<QueryClause> toList, Cons<? extends QueryClause> cons)
{
if (cons != null) {
toList.add(cons.head);
addAll(toList, cons.tail);
toList.add(cons.head);
}
}