Skip to content

Commit

Permalink
Merge pull request #163 from HubSpot/preserve-groupby-order
Browse files Browse the repository at this point in the history
Preserve groupby order
  • Loading branch information
Matt Coley authored Nov 30, 2017
2 parents 55a38d8 + 6193287 commit 88bd293
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.util.List;
import java.util.Objects;

import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.hubspot.jinjava.doc.annotations.JinjavaDoc;
Expand Down Expand Up @@ -49,7 +49,7 @@ public Object filter(Object var, JinjavaInterpreter interpreter, String... args)
String attr = args[0];

ForLoop loop = ObjectIterator.getLoop(var);
Multimap<String, Object> groupBuckets = ArrayListMultimap.create();
Multimap<String, Object> groupBuckets = LinkedListMultimap.create();

while (loop.hasNext()) {
Object val = loop.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ public void testGroupByAttr() throws Exception {
new Person("male", "jim", "jones"),
new Person("female", "barb", "smith")
))));

assertThat(dom.select("ul.root > li")).hasSize(2);
assertThat(dom.select("ul.root > li").get(0).text()).contains("male jared");
assertThat(dom.select("ul.root > li.male > ul > li")).hasSize(3);
assertThat(dom.select("ul.root > li.female > ul > li")).hasSize(2);
}
Expand Down

0 comments on commit 88bd293

Please sign in to comment.