Class AtomicReferenceArrayElementComparisonStrategy<T>

    • Field Detail

      • elementComparator

        private final java.util.Comparator<? super T> elementComparator
    • Constructor Detail

      • AtomicReferenceArrayElementComparisonStrategy

        public AtomicReferenceArrayElementComparisonStrategy​(java.util.Comparator<? super T> elementComparator)
    • Method Detail

      • areEqual

        public boolean areEqual​(java.lang.Object actual,
                                java.lang.Object other)
        Description copied from class: StandardComparisonStrategy
        Returns true if the arguments are deeply equal to each other, false otherwise.

        It mimics the behavior of Objects.deepEquals(Object, Object), but without performing a reference check between the two arguments. According to deepEquals javadoc, the reference check should be delegated to the equals method of the first argument, but this is not happening. Bug JDK-8196069 also mentions this gap.

        Specified by:
        areEqual in interface ComparisonStrategy
        Overrides:
        areEqual in class StandardComparisonStrategy
        Parameters:
        actual - the object to compare to other
        other - the object to compare to actual
        Returns:
        true if the arguments are deeply equal to each other, false otherwise
        See Also:
        JDK-8196069
      • compareElementsOf

        private boolean compareElementsOf​(java.util.concurrent.atomic.AtomicReferenceArray<T> actual,
                                          T[] other)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • asText

        public java.lang.String asText()
        Description copied from interface: ComparisonStrategy
        Used in error messages when a custom comparison strategy was used to compare values.

        For example ComparatorBasedComparisonStrategy returns:

        "when comparing values using " + toString()
        Returns:
        the comparison strategy description used in error messages.