Class ArraysShim


  • public class ArraysShim
    extends java.lang.Object
    Shim over JDK11 methods in Arrays to support multi-release
    • Constructor Summary

      Constructors 
      Constructor Description
      ArraysShim()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean equals​(char[] x, int xmin, int xmax, char[] y, int ymin, int ymax)
      Checks if the two arrays are equal within the given range.
      static int mismatch​(byte[] a, int aFromIndex, int aToIndex, byte[] b, int bFromIndex, int bToIndex)
      Finds and returns the relative index of the first mismatch between two byte arrays over the specified ranges,otherwise return -1 if no mismatch is found.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ArraysShim

        public ArraysShim()
    • Method Detail

      • equals

        public static boolean equals​(char[] x,
                                     int xmin,
                                     int xmax,
                                     char[] y,
                                     int ymin,
                                     int ymax)
        Checks if the two arrays are equal within the given range.
        Parameters:
        x - the first array
        xmin - the inclusive minimum of the range of the first array
        xmax - the exclusive maximum of the range of the first array
        y - the second array
        ymin - the inclusive minimum of the range of the second array
        ymax - the exclusive maximum of the range of the second array
        Returns:
        true if the arrays are equal in the specified ranges
      • mismatch

        public static int mismatch​(byte[] a,
                                   int aFromIndex,
                                   int aToIndex,
                                   byte[] b,
                                   int bFromIndex,
                                   int bToIndex)
        Finds and returns the relative index of the first mismatch between two byte arrays over the specified ranges,otherwise return -1 if no mismatch is found. The index will be in the range of 0 (inclusive) up to the length (inclusive) of the smaller range.
        Parameters:
        a - one input byte array
        aFromIndex - inclusive
        aToIndex - exclusive
        b - another input byte array
        bFromIndex - inclusive
        bToIndex - exclusive
        Returns:
        -1 if no mismatch found,otherwise the mismatch offset