diff --git a/jOOQ/src/main/java/org/jooq/Result.java b/jOOQ/src/main/java/org/jooq/Result.java index ea8e4c2fa8..6b73defec6 100644 --- a/jOOQ/src/main/java/org/jooq/Result.java +++ b/jOOQ/src/main/java/org/jooq/Result.java @@ -1844,7 +1844,8 @@ public interface Result extends FieldProvider, List, Attach * are non-unique. * * @param keys The keys. Client code must assure that keys are unique in the - * result set. + * result set. If this is null or an empty array, + * the resulting map will contain at most one entry. * @return A Map containing the results. * @throws InvalidResultException if the keys are non-unique in the result * set. @@ -1886,7 +1887,8 @@ public interface Result extends FieldProvider, List, Attach * Unlike {@link #intoMap(Field[])}, this method allows for non-unique keys * in the result set. * - * @param keys The keys. + * @param keys The keys. If this is null or an empty array, the + * resulting map will contain at most one entry. * @return A Map containing grouped results */ Map, Result> intoGroups(Field[] keys); diff --git a/jOOQ/src/main/java/org/jooq/impl/ResultImpl.java b/jOOQ/src/main/java/org/jooq/impl/ResultImpl.java index 658e4c93e6..5f5e556bce 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ResultImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/ResultImpl.java @@ -1393,8 +1393,8 @@ class ResultImpl implements Result, AttachableInternal { @Override public final Map, R> intoMap(Field[] keys) { - if (keys == null || keys.length == 0) { - throw new IllegalArgumentException("Keys must not be null or empty."); + if (keys == null) { + keys = new Field[0]; } Map, R> map = new LinkedHashMap, R>(); @@ -1454,8 +1454,8 @@ class ResultImpl implements Result, AttachableInternal { @Override public final Map, Result> intoGroups(Field[] keys) { - if (keys == null || keys.length == 0) { - throw new IllegalArgumentException("Keys must not be null or empty."); + if (keys == null) { + keys = new Field[0]; } Map, Result> map = new LinkedHashMap, Result>();