From e611353163a1eecff4152f25cbca6f0d5549da72 Mon Sep 17 00:00:00 2001 From: rob bygrave Date: Wed, 19 Dec 2018 15:22:32 +1300 Subject: [PATCH] No effective change - update javadoc for QueryIterator to use try with resources --- src/main/java/io/ebean/Query.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/ebean/Query.java b/src/main/java/io/ebean/Query.java index eb4e0daa4..601e3a889 100644 --- a/src/main/java/io/ebean/Query.java +++ b/src/main/java/io/ebean/Query.java @@ -668,15 +668,13 @@ public interface Query { * .where().eq("status", Status.NEW) * .order().asc("id"); * - * QueryIterator it = query.findIterate(); - * try { + * // use try with resources to ensure QueryIterator is closed + * + * try (QueryIterator it = query.findIterate()) { * while (it.hasNext()) { * Customer customer = it.next(); * // do something with customer ... * } - * } finally { - * // close the underlying resources - * it.close(); * } * * }