You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2021/12/12 10:19:24 UTC

[groovy] branch master updated: Trivial refactoring: simplify code checking duplicated names

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new c9817ef  Trivial refactoring: simplify code checking duplicated names
c9817ef is described below

commit c9817ef146dede9774fa3a88cec2b4c5b77d490a
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Dec 12 18:18:59 2021 +0800

    Trivial refactoring: simplify code checking duplicated names
---
 .../apache/groovy/ginq/provider/collection/runtime/NamedTuple.groovy    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/runtime/NamedTuple.groovy b/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/runtime/NamedTuple.groovy
index 4afcadb..e9c47d6 100644
--- a/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/runtime/NamedTuple.groovy
+++ b/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/runtime/NamedTuple.groovy
@@ -38,7 +38,7 @@ class NamedTuple<E> extends Tuple<E> {
         super(elementList as E[])
 
         int nameListSize = nameList.size()
-        if (nameListSize != new ArrayList<>(nameList).unique().size()) {
+        if (nameListSize != new HashSet<>(nameList).size()) {
             throw new IllegalArgumentException("names should be unique: $nameList")
         }