julianhyde commented on code in PR #3375:
URL: https://github.com/apache/calcite/pull/3375#discussion_r1309108471


##########
core/src/main/java/org/apache/calcite/util/Util.java:
##########
@@ -2166,6 +2167,24 @@ public static <E> boolean isDistinct(List<E> list) {
     return firstDuplicate(list) < 0;
   }
 
+
+  /**
+   * Returns whether the elements of {@code list} are distinct according to a 
given
+   * case-sensitivity policy.
+   */
+  public static boolean isDistinct(List<String> list, boolean caseSensitive) {
+    if (caseSensitive) {
+      return isDistinct(list);
+    }
+    final Set<String> set = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);

Review Comment:
   if list has 0 or 1 elements you can immediately return true



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to