From ca4ec1f4d34751de00221f8b5718de4c7da0923a Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 10 Oct 2013 22:06:34 +0000 Subject: [PATCH] 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. --- src/main/java/com/samskivert/depot/Query.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/samskivert/depot/Query.java b/src/main/java/com/samskivert/depot/Query.java index 1e6fc63..e1d460e 100644 --- a/src/main/java/com/samskivert/depot/Query.java +++ b/src/main/java/com/samskivert/depot/Query.java @@ -683,11 +683,13 @@ public class Query return new Cons(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 toList, Cons cons) { if (cons != null) { - toList.add(cons.head); addAll(toList, cons.tail); + toList.add(cons.head); } }