public static void main(String... args) throws Exception {
        withOrders(jdbi -> {

            // find five user ids in the database.
            List<Integer> userIds = jdbi.withHandle(
                handle -> handle.createQuery("SELECT DISTINCT user_id FROM orders LIMIT 5")
                    .mapTo(Integer.class)
                    .list());

            // pull out all orders that match the user ids
            Multimap<Integer, Order> results = jdbi.withHandle(
                handle -> handle.createQuery("SELECT * from orders WHERE user_id IN (<user_id>)")
                    .bindList("user_id", userIds)
                    .mapTo(Order.class)
                    .collect(toImmutableListMultimap(Order::getUserId, Functions.identity())));

            // display results
            results.asMap().forEach((k, v) -> System.out.printf("%d -> %s%n", k, v));
        });
    }
Map a list or results based on an attribute onto a map. Multiple results can map on the same attribute, so using a Guava Multimap (which is a map of lists)
solves that problem.
<p>
Also shows the use of {@link org.jdbi.v3.core.result.ResultIterable#collect(Collector)}.
examples/src/main/java/org/jdbi/v3/examples/ResultsAsMultimap.java