[#1830] Allow for passing null or empty arrays to intoMap(Field[]) and
intoGroups(Field[])
This commit is contained in:
parent
907b0d45cf
commit
6cd084e77f
@ -1844,7 +1844,8 @@ public interface Result<R extends Record> extends FieldProvider, List<R>, 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 <code>null</code> 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<R extends Record> extends FieldProvider, List<R>, 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 <code>null</code> or an empty array, the
|
||||
* resulting map will contain at most one entry.
|
||||
* @return A Map containing grouped results
|
||||
*/
|
||||
Map<List<?>, Result<R>> intoGroups(Field<?>[] keys);
|
||||
|
||||
@ -1393,8 +1393,8 @@ class ResultImpl<R extends Record> implements Result<R>, AttachableInternal {
|
||||
|
||||
@Override
|
||||
public final Map<List<?>, 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<List<?>, R> map = new LinkedHashMap<List<?>, R>();
|
||||
@ -1454,8 +1454,8 @@ class ResultImpl<R extends Record> implements Result<R>, AttachableInternal {
|
||||
|
||||
@Override
|
||||
public final Map<List<?>, Result<R>> 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<List<?>, Result<R>> map = new LinkedHashMap<List<?>, Result<R>>();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user