Clarify Arrays' equals and mismatch that take a reference type and comparator

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 22
    • Component/s: core-libs
    • None

      It's not sufficiently explicit that the comparator is used as an external equality check and, thus, only needs to reliably separate equal elements from unequal ones.

      It's important for a developer to be certain that it's fine to implement such a comparator, for example, like this:

          public static <T> Comparator<T> newEqualityComparator() {
              return (o1, o2) -> Objects.equals(o1, o2) ? 0 : -1;
          }

      Not only does it go against ingrained practices, but it might also be flagged as suspicious by IDEs and static analysis tools. So, more help and reassurance from documentation is in order.

            Assignee:
            Unassigned
            Reporter:
            Pavel Rappo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: