changeset 14602:d7a1ecbf9318

Merge
author prr
date Mon, 09 Nov 2015 09:05:20 -0800
parents 43cc5deb748a 6cfb4df38b6d
children 3c1ed8084a75
files
diffstat 53 files changed, 5479 insertions(+), 487 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Fri Nov 06 19:13:16 2015 +0300
+++ b/.hgtags	Mon Nov 09 09:05:20 2015 -0800
@@ -332,3 +332,5 @@
 110fc90bdfa0fe59606c047c2301ed75d2bad6cf jdk9-b87
 6e50b992bef4def597a5033e696e5b1d4fe5b294 jdk9-b88
 0d0a63b325592607974612f9cfb48590975aa2d6 jdk9-b89
+b433e4dfb830fea60e5187e4580791b62cc362d2 jdk9-b90
+97624df5026a2fb191793697dbd2c604c4d5c66e jdk9-b91
--- a/make/launcher/Launcher-java.base.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-java.base.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -25,32 +25,51 @@
 
 include LauncherCommon.gmk
 
+JAVA_RC_FLAGS += -i $(JDK_TOPDIR)/src/java.base/windows/native/common
+ifdef OPENJDK
+  JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/java.base/windows/native/launcher/icons"
+else
+  JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/java.base/windows/native/launcher/icons"
+endif
+
 ################################################################################
 
 # On windows, the debuginfo files get the same name as for java.dll. Build
 # into another dir and copy selectively so debuginfo for java.dll isn't
 # overwritten.
-$(eval $(call SetupLauncher,java, \
-    -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES,,,user32.lib comctl32.lib, \
-    $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jli_static.lib, $(JAVA_RC_FLAGS), \
-    $(JAVA_VERSION_INFO_RESOURCE), $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs,true))
+$(eval $(call SetupBuildLauncher, java, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \
+    LDFLAGS_solaris := -R$(OPENWIN_HOME)/lib$(OPENJDK_TARGET_CPU_ISADIR), \
+    LIBS_windows := user32.lib comctl32.lib, \
+    RC_FLAGS := $(JAVA_RC_FLAGS), \
+    VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \
+    OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs, \
+    OPTIMIZATION := HIGH, \
+    WINDOWS_STATIC_LINK := true, \
+    NO_JAVA_MS := true, \
+))
 
 $(SUPPORT_OUTPUTDIR)/modules_cmds/java.base/java$(EXE_SUFFIX): $(BUILD_LAUNCHER_java)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
-	$(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX) $@
+	$(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs/java$(EXE_SUFFIX) $@
 
 TARGETS += $(SUPPORT_OUTPUTDIR)/modules_cmds/java.base/java$(EXE_SUFFIX)
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-  $(eval $(call SetupLauncher,javaw, \
-      -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES,,,user32.lib comctl32.lib, \
-      $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jli_static.lib, $(JAVA_RC_FLAGS), \
-      $(JAVA_VERSION_INFO_RESOURCE),,true))
+  $(eval $(call SetupBuildLauncher, javaw, \
+      CFLAGS := -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \
+      LIBS_windows := user32.lib comctl32.lib, \
+      RC_FLAGS := $(JAVA_RC_FLAGS), \
+      VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \
+      WINDOWS_STATIC_LINK := true, \
+      NO_JAVA_MS := true, \
+  ))
 endif
 
-$(eval $(call SetupLauncher,keytool, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.keytool.Main"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, keytool, \
+    MAIN_CLASS := sun.security.tools.keytool.Main, \
+))
 
 ################################################################################
 
--- a/make/launcher/Launcher-java.corba.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-java.corba.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,23 +25,26 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,idlj, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.corba.se.idl.toJavaPortable.Compile"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, idlj, \
+    MAIN_CLASS := com.sun.tools.corba.se.idl.toJavaPortable.Compile, \
+))
 
-$(eval $(call SetupLauncher,orbd, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
-        "-J-Dcom.sun.CORBA.activation.DbDir=./orb.db"$(COMMA) \
-        "-J-Dcom.sun.CORBA.activation.Port=1049"$(COMMA) \
-        "-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \
-        "com.sun.corba.se.impl.activation.ORBD"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, orbd, \
+    MAIN_CLASS := com.sun.corba.se.impl.activation.ORBD, \
+    JAVA_ARGS := \
+        -Dcom.sun.CORBA.activation.DbDir=./orb.db \
+        -Dcom.sun.CORBA.activation.Port=1049 \
+        -Dcom.sun.CORBA.POA.ORBServerId=1, \
+))
 
-$(eval $(call SetupLauncher,servertool, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.corba.se.impl.activation.ServerTool"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, servertool, \
+    MAIN_CLASS := com.sun.corba.se.impl.activation.ServerTool, \
+))
 
-$(eval $(call SetupLauncher,tnameserv, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
-        "-J-Dcom.sun.CORBA.activation.DbDir=./orb.db"$(COMMA) \
-        "-J-Djava.util.logging.LoggingPermission=contol"$(COMMA) \
-        "-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \
-        "com.sun.corba.se.impl.naming.cosnaming.TransientNameServer"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, tnameserv, \
+    MAIN_CLASS := com.sun.corba.se.impl.naming.cosnaming.TransientNameServer, \
+    JAVA_ARGS := \
+        -Dcom.sun.CORBA.activation.DbDir=./orb.db \
+        -Djava.util.logging.LoggingPermission=contol \
+        -Dcom.sun.CORBA.POA.ORBServerId=1, \
+))
--- a/make/launcher/Launcher-java.desktop.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-java.desktop.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -29,8 +29,8 @@
 $(eval $(call IncludeCustomExtension, jdk, launcher/Launcher-java.desktop.gmk))
 
 ifndef BUILD_HEADLESS_ONLY
-  $(eval $(call SetupLauncher,appletviewer, \
-      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.applet.Main"$(COMMA) }',, \
-      $(XLIBS)))
+  $(eval $(call SetupBuildLauncher, appletviewer, \
+      MAIN_CLASS := sun.applet.Main, \
+      LIBS_unix := $(X_LIBS), \
+  ))
 endif
-
--- a/make/launcher/Launcher-java.rmi.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-java.rmi.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,10 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,rmid, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.server.Activation"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, rmid, \
+    MAIN_CLASS := sun.rmi.server.Activation, \
+))
 
-$(eval $(call SetupLauncher,rmiregistry, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.registry.RegistryImpl"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, rmiregistry, \
+    MAIN_CLASS := sun.rmi.registry.RegistryImpl, \
+))
--- a/make/launcher/Launcher-java.scripting.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-java.scripting.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,6 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jrunscript, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.script.shell.Main"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, jrunscript, \
+    MAIN_CLASS := com.sun.tools.script.shell.Main, \
+))
--- a/make/launcher/Launcher-java.security.jgss.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-java.security.jgss.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,13 +26,15 @@
 include LauncherCommon.gmk
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-  $(eval $(call SetupLauncher,kinit, \
-      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Kinit"$(COMMA) }'))
+  $(eval $(call SetupBuildLauncher, kinit, \
+      MAIN_CLASS := sun.security.krb5.internal.tools.Kinit, \
+  ))
 
-  $(eval $(call SetupLauncher,klist, \
-      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Klist"$(COMMA) }'))
+  $(eval $(call SetupBuildLauncher, klist, \
+      MAIN_CLASS := sun.security.krb5.internal.tools.Klist, \
+  ))
 
-  $(eval $(call SetupLauncher,ktab, \
-      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Ktab"$(COMMA) }'))
+  $(eval $(call SetupBuildLauncher, ktab, \
+      MAIN_CLASS := sun.security.krb5.internal.tools.Ktab, \
+  ))
 endif
-
--- a/make/launcher/Launcher-jdk.compiler.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-jdk.compiler.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,26 +25,30 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,javac, \
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javac.Main"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, javac, \
+   MAIN_CLASS := com.sun.tools.javac.Main, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
+        -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
+))
 
-$(eval $(call SetupLauncher,javah, \
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javah.Main"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, javah, \
+    MAIN_CLASS := com.sun.tools.javah.Main, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
+        -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
+))
 
-$(eval $(call SetupLauncher,serialver, \
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.serialver.SerialVer"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, serialver, \
+    MAIN_CLASS := sun.tools.serialver.SerialVer, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \
+))
 
 ifeq ($(ENABLE_SJAVAC), yes)
   # Build sjavac directly to the exploded image so that it does not get included
   # into any real images
-  $(eval $(call SetupLauncher,sjavac, \
-      -DEXPAND_CLASSPATH_WILDCARDS \
-      -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.sjavac.Main"$(COMMA) }',,,,,,, \
-      $(JDK_OUTPUTDIR)/bin))
+  $(eval $(call SetupBuildLauncher, sjavac, \
+      MAIN_CLASS := com.sun.tools.sjavac.Main, \
+      CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
+          -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
+      OUTPUT_DIR := $(JDK_OUTPUTDIR)/bin, \
+  ))
 endif
--- a/make/launcher/Launcher-jdk.dev.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-jdk.dev.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,5 +25,6 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jimage,\
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.tools.jimage.Main"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, jimage,\
+    MAIN_CLASS := jdk.tools.jimage.Main, \
+))
--- a/make/launcher/Launcher-jdk.hotspot.agent.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-jdk.hotspot.agent.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,13 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jsadebugd, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \
-    ,,,,,,,,,Info-privileged.plist))
+$(eval $(call SetupBuildLauncher, jsadebugd, \
+    MAIN_CLASS := sun.jvm.hotspot.jdi.SADebugServer, \
+    MACOSX_SIGNED := true, \
+))
 
 
-$(eval $(call SetupLauncher,jhsdb, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.SALauncher"$(COMMA) }' \
-    ,,,,,,,,,Info-privileged.plist))
-
+$(eval $(call SetupBuildLauncher, jhsdb, \
+    MAIN_CLASS := sun.jvm.hotspot.SALauncher, \
+    MACOSX_SIGNED := true, \
+))
--- a/make/launcher/Launcher-jdk.jartool.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-jdk.jartool.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -25,8 +25,10 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jar, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, jar, \
+    MAIN_CLASS := sun.tools.jar.Main, \
+))
 
-$(eval $(call SetupLauncher,jarsigner, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jarsigner.Main"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, jarsigner, \
+    MAIN_CLASS := sun.security.tools.jarsigner.Main, \
+))
--- a/make/launcher/Launcher-jdk.javadoc.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-jdk.javadoc.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,javadoc, \
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javadoc.Main"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, javadoc, \
+    MAIN_CLASS := com.sun.tools.javadoc.Main, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
+        -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
+))
--- a/make/launcher/Launcher-jdk.jcmd.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-jdk.jcmd.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,36 +25,41 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jinfo, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
-        "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
-        "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
-        "sun.tools.jinfo.JInfo"$(COMMA) }' \
-    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
-    ,,,,,,,,,Info-privileged.plist))
+$(eval $(call SetupBuildLauncher, jinfo, \
+    MAIN_CLASS := sun.tools.jinfo.JInfo, \
+    JAVA_ARGS := \
+        -Dsun.jvm.hotspot.debugger.useProcDebugger \
+        -Dsun.jvm.hotspot.debugger.useWindbgDebugger, \
+    APP_CLASSPATH := /lib/tools.jar /lib/sa-jdi.jar /classes, \
+    MACOSX_SIGNED := true, \
+))
 
-$(eval $(call SetupLauncher,jmap, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
-        "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
-        "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
-        "sun.tools.jmap.JMap"$(COMMA) }' \
-    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
-    ,,,,,,,,,Info-privileged.plist))
+$(eval $(call SetupBuildLauncher, jmap, \
+    MAIN_CLASS := sun.tools.jmap.JMap, \
+    JAVA_ARGS := \
+        -Dsun.jvm.hotspot.debugger.useProcDebugger \
+        -Dsun.jvm.hotspot.debugger.useWindbgDebugger, \
+    APP_CLASSPATH := /lib/tools.jar /lib/sa-jdi.jar /classes, \
+    MACOSX_SIGNED := true, \
+))
 
-$(eval $(call SetupLauncher,jps, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jps.Jps"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, jps, \
+    MAIN_CLASS := sun.tools.jps.Jps, \
+))
 
-$(eval $(call SetupLauncher,jstack, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
-        "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
-        "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
-        "sun.tools.jstack.JStack"$(COMMA) }' \
-    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
-    ,,,,,,,,,Info-privileged.plist))
+$(eval $(call SetupBuildLauncher, jstack, \
+    MAIN_CLASS := sun.tools.jstack.JStack, \
+    JAVA_ARGS := \
+        -Dsun.jvm.hotspot.debugger.useProcDebugger \
+        -Dsun.jvm.hotspot.debugger.useWindbgDebugger, \
+    APP_CLASSPATH := /lib/tools.jar /lib/sa-jdi.jar /classes, \
+    MACOSX_SIGNED := true, \
+))
 
-$(eval $(call SetupLauncher,jstat, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstat.Jstat"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, jstat, \
+    MAIN_CLASS := sun.tools.jstat.Jstat, \
+))
 
-$(eval $(call SetupLauncher,jcmd, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jcmd.JCmd"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, jcmd, \
+    MAIN_CLASS := sun.tools.jcmd.JCmd, \
+))
--- a/make/launcher/Launcher-jdk.jconsole.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-jdk.jconsole.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -25,9 +25,10 @@
 
 include LauncherCommon.gmk
 
-BUILD_LAUNCHER_jconsole_CFLAGS_windows := -DJAVAW
-BUILD_LAUNCHER_jconsole_LIBS_windows := user32.lib
-
-$(eval $(call SetupLauncher,jconsole, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "-J-Djconsole.showOutputViewer"$(COMMA) "sun.tools.jconsole.JConsole"$(COMMA) }' \
-    -DAPP_CLASSPATH='{ "/lib/jconsole.jar"$(COMMA) "/lib/tools.jar"$(COMMA) "/classes" }'))
+$(eval $(call SetupBuildLauncher, jconsole, \
+    MAIN_CLASS := sun.tools.jconsole.JConsole, \
+    JAVA_ARGS := -Djconsole.showOutputViewer, \
+    APP_CLASSPATH := /lib/jconsole.jar /lib/tools.jar /classes, \
+    CFLAGS_windows := -DJAVAW, \
+    LIBS_windows := user32.lib, \
+))
--- a/make/launcher/Launcher-jdk.jdeps.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-jdk.jdeps.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -25,12 +25,14 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,javap, \
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javap.Main"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, javap, \
+    MAIN_CLASS := com.sun.tools.javap.Main, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
+        -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
+))
 
-$(eval $(call SetupLauncher,jdeps, \
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.jdeps.Main"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, jdeps, \
+    MAIN_CLASS := com.sun.tools.jdeps.Main, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
+        -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
+))
--- a/make/launcher/Launcher-jdk.jdi.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-jdk.jdi.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jdb, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.example.debug.tty.TTY"$(COMMA) }' \
-    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }'))
-
+$(eval $(call SetupBuildLauncher, jdb, \
+    MAIN_CLASS := com.sun.tools.example.debug.tty.TTY, \
+    APP_CLASSPATH := /lib/tools.jar /lib/sa-jdi.jar /classes, \
+))
--- a/make/launcher/Launcher-jdk.jshell.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-jdk.jshell.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -25,7 +25,8 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jshell, \
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.internal.jshell.tool.JShellTool"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, jshell, \
+    MAIN_CLASS := jdk.internal.jshell.tool.JShellTool, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
+        -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
+))
--- a/make/launcher/Launcher-jdk.jvmstat.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-jdk.jvmstat.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,6 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jstatd, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstatd.Jstatd"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, jstatd, \
+    MAIN_CLASS := sun.tools.jstatd.Jstatd, \
+))
--- a/make/launcher/Launcher-jdk.pack200.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-jdk.pack200.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -25,8 +25,9 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,pack200, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.java.util.jar.pack.Driver"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, pack200, \
+    MAIN_CLASS := com.sun.java.util.jar.pack.Driver, \
+))
 
 ################################################################################
 # The order of the object files on the link command line affects the size of the resulting
@@ -92,7 +93,7 @@
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(UNPACKEXE_LIBS) $(LIBCXX), \
     LIBS_solaris :=  -lc, \
-    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe$(OUTPUT_SUBDIR), \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe, \
     OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE), \
     PROGRAM := unpack200, \
     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
--- a/make/launcher/Launcher-jdk.policytool.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-jdk.policytool.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,8 @@
 include LauncherCommon.gmk
 
 ifndef BUILD_HEADLESS_ONLY
-  $(eval $(call SetupLauncher,policytool, \
-      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',, \
-      $(XLIBS)))
+  $(eval $(call SetupBuildLauncher, policytool, \
+      MAIN_CLASS := sun.security.tools.policytool.PolicyTool, \
+      LIBS_unix := $(X_LIBS), \
+  ))
 endif
--- a/make/launcher/Launcher-jdk.rmic.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-jdk.rmic.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,rmic, \
-    -DEXPAND_CLASSPATH_WILDCARDS \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.rmic.Main"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, rmic, \
+    MAIN_CLASS := sun.rmi.rmic.Main, \
+    CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \
+))
--- a/make/launcher/Launcher-jdk.scripting.nashorn.shell.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-jdk.scripting.nashorn.shell.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,jjs, \
-    -DENABLE_ARG_FILES \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.nashorn.tools.jjs.Main"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, jjs, \
+    MAIN_CLASS := jdk.nashorn.tools.jjs.Main, \
+    CFLAGS := -DENABLE_ARG_FILES, \
+))
--- a/make/launcher/Launcher-jdk.xml.bind.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-jdk.xml.bind.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,10 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,schemagen, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.jxc.SchemaGenerator"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, schemagen, \
+    MAIN_CLASS := com.sun.tools.internal.jxc.SchemaGenerator, \
+))
 
-$(eval $(call SetupLauncher,xjc, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.xjc.Driver"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, xjc, \
+    MAIN_CLASS := com.sun.tools.internal.xjc.Driver, \
+))
--- a/make/launcher/Launcher-jdk.xml.ws.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/Launcher-jdk.xml.ws.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,10 @@
 
 include LauncherCommon.gmk
 
-$(eval $(call SetupLauncher,wsgen, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsGen"$(COMMA) }'))
+$(eval $(call SetupBuildLauncher, wsgen, \
+    MAIN_CLASS := com.sun.tools.internal.ws.WsGen, \
+))
 
-$(eval $(call SetupLauncher,wsimport, \
-    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsImport"$(COMMA) }'))
-
+$(eval $(call SetupBuildLauncher, wsimport, \
+    MAIN_CLASS := com.sun.tools.internal.ws.WsImport, \
+))
--- a/make/launcher/LauncherCommon.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/launcher/LauncherCommon.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -28,28 +28,17 @@
 # Prepare the find cache.
 $(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/java.base/share/native/launcher))
 
-# When building a legacy overlay image (on solaris 64 bit), the launchers
-# need to be built with a different rpath and a different output dir.
-ifeq ($(OVERLAY_IMAGES), true)
-  ORIGIN_ROOT := /../..
-  OUTPUT_SUBDIR := $(OPENJDK_TARGET_CPU_ISADIR)
-else
-  ORIGIN_ROOT := /..
-endif
-
 ifeq ($(OPENJDK_TARGET_OS), macosx)
   ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN)
 else
-  ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli)
-endif
+  ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,/../lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli)
 
-#
-# Applications expect to be able to link against libjawt without invoking
-# System.loadLibrary("jawt") first. This was the behaviour described in the
-# devloper documentation of JAWT and what worked with OpenJDK6.
-#
-ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
-  ORIGIN_ARG += $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR))
+  # Applications expect to be able to link against libjawt without invoking
+  # System.loadLibrary("jawt") first. This was the behaviour described in the
+  # devloper documentation of JAWT and what worked with OpenJDK6.
+  ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
+    ORIGIN_ARG += $(call SET_EXECUTABLE_ORIGIN,/../lib$(OPENJDK_TARGET_CPU_LIBDIR))
+  endif
 endif
 
 LAUNCHER_SRC := $(JDK_TOPDIR)/src/java.base/share/native/launcher
@@ -61,51 +50,78 @@
 GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
 JAVA_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.rc
 MACOSX_PLIST_DIR := $(JDK_TOPDIR)/src/java.base/macosx/native/launcher
-# Until the shuffle is permanent, we can't add this in configure
-CFLAGS_JDKEXE := $(filter-out %javavm/export, $(CFLAGS_JDKEXE))
-CFLAGS_JDKEXE += -I$(JDK_TOPDIR)/src/java.base/share/native/include \
-    -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include
-CXXFLAGS_JDKEXE := $(filter-out %javavm/export, $(CXXFLAGS_JDKEXE))
-CXXFLAGS_JDKEXE += -I$(JDK_TOPDIR)/src/java.base/share/native/include \
-    -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include
 JAVA_MANIFEST := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.manifest
 
-define SetupLauncher
-  # TODO: Fix mapfile on solaris. Won't work with ld as linker.
-  # Parameter 1 is the name of the launcher (java, javac, jar...)
-  # Parameter 2 is extra CFLAGS
-  # Parameter 3 is extra LDFLAGS
-  # Parameter 4 is extra LIBS_unix
-  # Parameter 5 is extra LIBS_windows
-  # Parameter 6 is optional Windows JLI library (full path)
-  # Parameter 7 is optional Windows resource (RC) flags
-  # Parameter 8 is optional Windows version resource file (.rc)
-  # Parameter 9 is different output dir
-  # Parameter 10 if set, link statically with c runtime on windows.
-  # Parameter 11 if set, override plist file on macosx.
-  $(call LogSetupMacroEntry,SetupLauncher($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11))
-  $(if $(13),$(error Internal makefile error: Too many arguments to SetupLauncher, please update CompileLaunchers.gmk))
+################################################################################
+# Build standard launcher.
 
-  $1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib
-  ifneq ($6, )
-    $1_WINDOWS_JLI_LIB := $6
-  endif
-  $1_VERSION_INFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE)
-  ifneq ($8, )
-    $1_VERSION_INFO_RESOURCE := $8
+# Setup make rules for building a standard launcher.
+#
+# Parameter 1 is the name of the rule. This name is used as variable prefix,
+# and the targets generated are listed in a variable by that name. It is also
+# used as the name of the executable.
+#
+# Remaining parameters are named arguments. These include:
+# MAIN_CLASS   The Java main class to launch
+# JAVA_ARGS   Processed into a -DJAVA_ARGS C flag
+# APP_CLASSPATH   Processed into a -DAPP_CLASSPATH C flag
+# CFLAGS   Additional CFLAGS
+# CFLAGS_windows   Additional CFLAGS_windows
+# LIBS_unix   Additional LIBS_unix
+# LIBS_windows   Additional LIBS_windows
+# LDFLAGS_solaris Additional LDFLAGS_solaris
+# RC_FLAGS   Additional RC_FLAGS
+# MACOSX_SIGNED   On macosx, sign this binary
+# WINDOWS_STATIC_LINK   On windows, link statically with C runtime and libjli.
+# OPTIMIZATION   Override default optimization level (LOW)
+# OUTPUT_DIR   Override default output directory
+# VERSION_INFO_RESOURCE   Override default Windows resource file
+# NO_JAVA_MS   Do not add -ms8m to JAVA_ARGS.
+SetupBuildLauncher = $(NamedParamsMacroTemplate)
+define SetupBuildLauncherBody
+  # Setup default values (unless overridden)
+  ifeq ($$($1_VERSION_INFO_RESOURCE), )
+    $1_VERSION_INFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE)
   endif
 
-  $1_LDFLAGS := $3
+  ifeq ($$($1_OUTPUT_DIR), )
+    $1_OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)
+  endif
+
+  ifeq ($$($1_OPTIMIZATION), )
+    $1_OPTIMIZATION := LOW
+  endif
+
+  ifneq ($$($1_NO_JAVA_MS), true)
+    # The norm is to append -ms8m, unless otherwise instructed.
+    $1_JAVA_ARGS += -ms8m
+  endif
+
+  ifneq ($$($1_JAVA_ARGS), )
+    $1_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \
+        $$(addprefix -J, $$($1_JAVA_ARGS)) $$($1_MAIN_CLASS), "$$a"$(COMMA) )) }'
+    $1_CFLAGS += -DJAVA_ARGS=$$($1_JAVA_ARGS_STR)
+  endif
+
+  ifneq ($$($1_APP_CLASSPATH), )
+    $1_APP_CLASSPATH_STR := '{ $$(strip $$(foreach a, \
+        $$($1_APP_CLASSPATH), "$$a"$(COMMA) )) }'
+    # Remove the trailing comma
+    $1_APP_CLASSPATH_STR := $$(strip $$(subst $$(COMMA) }', }', \
+        $$($1_APP_CLASSPATH_STR)))
+    $1_CFLAGS += -DAPP_CLASSPATH=$$($1_APP_CLASSPATH_STR)
+  endif
+
   $1_LIBS :=
   ifeq ($(OPENJDK_TARGET_OS), macosx)
-    $1_PLIST_FILE := Info-cmdline.plist
-    ifneq ($(11), )
-      $1_PLIST_FILE := $(11)
-      ifneq ($$(findstring privileged, $$($1_PLIST_FILE)), )
+    ifeq ($$($1_MACOSX_SIGNED), true)
+      $1_PLIST_FILE := Info-privileged.plist
         $1_CODESIGN := true
-      endif
+    else
+      $1_PLIST_FILE := Info-cmdline.plist
     endif
 
+    $1_CFLAGS += -DPACKAGE_PATH='"$(PACKAGE_PATH)"'
     $1_LDFLAGS += -Wl,-all_load $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a \
         -sectcreate __TEXT __info_plist $(MACOSX_PLIST_DIR)/$$($1_PLIST_FILE)
     $1_LIBS += -framework Cocoa -framework Security \
@@ -121,22 +137,12 @@
     $1_LIBS += -lz
   endif
 
-  $1_OUTPUT_DIR_ARG := $9
-  ifeq (, $$($1_OUTPUT_DIR_ARG))
-    $1_OUTPUT_DIR_ARG := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)
-  endif
-
-  # TODO: maybe it's better to move this if-statement out of this function
-  ifeq ($1, java)
-    $1_OPTIMIZATION_ARG := HIGH
-    $1_LDFLAGS_solaris := -R$(OPENWIN_HOME)/lib$(OPENJDK_TARGET_CPU_ISADIR)
+  ifeq ($$($1_WINDOWS_STATIC_LINK), true)
+    $1_CFLAGS += $(filter-out -MD, $(CFLAGS_JDKEXE))
+    $1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/jli_static.lib
   else
-    $1_OPTIMIZATION_ARG := LOW
-  endif
-
-  $1_CFLAGS := $(CFLAGS_JDKEXE)
-  ifeq ($(10), true)
-    $1_CFLAGS := $(filter-out -MD, $(CFLAGS_JDKEXE))
+    $1_CFLAGS += $(CFLAGS_JDKEXE)
+    $1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib
   endif
 
   # The linker on older SuSE distros (e.g. on SLES 10) complains with:
@@ -156,22 +162,23 @@
     endif
   endif
 
-  $(call SetupNativeCompilation,BUILD_LAUNCHER_$1, \
+  $$(eval $$(call SetupNativeCompilation, BUILD_LAUNCHER_$1, \
       SRC := $(LAUNCHER_SRC), \
       INCLUDE_FILES := main.c, \
-      OPTIMIZATION := $$($1_OPTIMIZATION_ARG), \
+      OPTIMIZATION := $$($1_OPTIMIZATION), \
       CFLAGS := $$($1_CFLAGS) \
           $(LAUNCHER_CFLAGS) \
           -DFULL_VERSION='"$(FULL_VERSION)"' \
           -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
           -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
           -DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \
-          -DPROGNAME='"$1"' $(DPACKAGEPATH) \
-          $2, \
+          -DPROGNAME='"$1"' \
+          $$($1_CFLAGS), \
       CFLAGS_linux := -fPIC, \
       CFLAGS_solaris := -KPIC -DHAVE_GETHRTIME, \
+      CFLAGS_windows := $$($1_CFLAGS_windows), \
       LDFLAGS := $(LDFLAGS_JDKEXE) \
-          $(ORIGIN_ARG) \
+          $$(ORIGIN_ARG) \
           $$($1_LDFLAGS), \
       LDFLAGS_linux := \
           $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)) \
@@ -182,27 +189,29 @@
           -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)/jli, \
       MAPFILE := $$($1_MAPFILE), \
       LIBS := $(JDKEXE_LIBS) $$($1_LIBS), \
-      LIBS_unix := $4, \
+      LIBS_unix := $$($1_LIBS_unix), \
       LIBS_linux := -lpthread -ljli $(LIBDL) -lc, \
       LIBS_solaris := -ljli -lthread $(LIBDL) -lc, \
       LIBS_windows := $$($1_WINDOWS_JLI_LIB) \
-          $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib advapi32.lib $5, \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$1_objs$(OUTPUT_SUBDIR), \
-      OUTPUT_DIR := $$($1_OUTPUT_DIR_ARG)$(OUTPUT_SUBDIR), \
+          $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib advapi32.lib \
+          $$($1_LIBS_windows), \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$1_objs, \
+      OUTPUT_DIR := $$($1_OUTPUT_DIR), \
       PROGRAM := $1, \
       DEBUG_SYMBOLS := true, \
       VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \
-      RC_FLAGS := $(RC_FLAGS) \
+      RC_FLAGS := $$(RC_FLAGS) \
           -D "JDK_FNAME=$1$(EXE_SUFFIX)" \
           -D "JDK_INTERNAL_NAME=$1" \
           -D "JDK_FTYPE=0x1L" \
-          $7, \
+          $$($1_RC_FLAGS), \
       MANIFEST := $(JAVA_MANIFEST), \
       MANIFEST_VERSION := $(JDK_VERSION_FOR_MANIFEST), \
       CODESIGN := $$($1_CODESIGN), \
-  )
+  ))
 
-  TARGETS += $$(BUILD_LAUNCHER_$1)
+  $1 += $$(BUILD_LAUNCHER_$1)
+  TARGETS += $$($1)
 
   ifneq (,$(filter $(OPENJDK_TARGET_OS), macosx aix))
     $$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a
@@ -213,18 +222,3 @@
         $$($1_WINDOWS_JLI_LIB)
   endif
 endef
-
-##########################################################################################
-
-XLIBS := $(X_LIBS) -lX11
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-  DPACKAGEPATH := -DPACKAGE_PATH='"$(PACKAGE_PATH)"'
-  XLIBS :=
-endif
-
-JAVA_RC_FLAGS += -i $(JDK_TOPDIR)/src/java.base/windows/native/common
-ifdef OPENJDK
-  JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/java.base/windows/native/launcher/icons"
-else
-  JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/java.base/windows/native/launcher/icons"
-endif
--- a/make/lib/Awt2dLibraries.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/lib/Awt2dLibraries.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -476,7 +476,7 @@
 ifeq ($(USE_EXTERNAL_LIBJPEG), true)
   LIBJPEG_LIBS := -ljpeg
   BUILD_LIBJAVAJPEG_INCLUDE_FILES := \
-      imageIOJPEG.c \
+      imageioJPEG.c \
       jpegdecoder.c
   BUILD_LIBJAVAJPEG_HEADERS :=
 else
@@ -890,9 +890,9 @@
       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
       LDFLAGS := $(LIBSPLASHSCREEN_LDFLAGS) $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
-      LIBS := $(LIBSPLASHSCREEN_LIBS) $(LIBZ) \
+      LIBS := $(JDKLIB_LIBS) $(LIBSPLASHSCREEN_LIBS) $(LIBZ) \
                         $(GIFLIB_LIBS) $(LIBJPEG_LIBS) $(PNG_LIBS), \
-      LIBS_solaris := -lc, \
+      LIBS_aix := -liconv, \
       VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
       RC_FLAGS := $(RC_FLAGS) \
           -D "JDK_FNAME=splashscreen.dll" \
--- a/make/lib/CoreLibraries.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/lib/CoreLibraries.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -139,6 +139,12 @@
   endif
 endif
 
+ifeq ($(OPENJDK_TARGET_OS), linux)
+  ifeq ($(OPENJDK_TARGET_CPU), x86_64)
+    BUILD_LIBJAVA_Bits.c_CFLAGS := $(C_O_FLAG_NORM)
+  endif
+endif
+
 $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
     LIBRARY := java, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
--- a/make/lib/Lib-java.instrument.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/lib/Lib-java.instrument.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -68,10 +68,11 @@
     LDFLAGS_macosx := -Xlinker -all_load $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a, \
     LDFLAGS_aix := -L$(SUPPORT_OUTPUTDIR)/native/java.base, \
     LDFLAGS_windows := -export:Agent_OnAttach, \
+    LIBS := $(JDKLIB_LIBS), \
     LIBS_unix := -ljava $(LIBZ), \
     LIBS_linux := -ljli $(LIBDL), \
-    LIBS_solaris := -ljli $(LIBDL) -lc, \
-    LIBS_aix := -ljli_static $(LIBDL),\
+    LIBS_solaris := -ljli $(LIBDL), \
+    LIBS_aix := -liconv -ljli_static $(LIBDL), \
     LIBS_macosx := -liconv -framework Cocoa -framework Security \
         -framework ApplicationServices, \
     LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib \
--- a/make/lib/Lib-jdk.jdwp.agent.gmk	Fri Nov 06 19:13:16 2015 +0300
+++ b/make/lib/Lib-jdk.jdwp.agent.gmk	Mon Nov 09 09:05:20 2015 -0800
@@ -84,10 +84,11 @@
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjdwp/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
+    LIBS := $(JDKLIB_LIBS), \
     LIBS_linux := $(LIBDL), \
-    LIBS_solaris := $(LIBDL) -lc, \
+    LIBS_solaris := $(LIBDL), \
     LIBS_macosx := -liconv, \
-    LIBS_windows := $(JDKLIB_LIBS), \
+    LIBS_aix := -liconv, \
     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
     RC_FLAGS := $(RC_FLAGS) \
         -D "JDK_FNAME=jdwp.dll" \
--- a/src/java.base/share/classes/java/lang/Byte.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/src/java.base/share/classes/java/lang/Byte.java	Mon Nov 09 09:05:20 2015 -0800
@@ -463,6 +463,22 @@
     }
 
     /**
+     * Compares two {@code byte} values numerically treating the values
+     * as unsigned.
+     *
+     * @param  x the first {@code byte} to compare
+     * @param  y the second {@code byte} to compare
+     * @return the value {@code 0} if {@code x == y}; a value less
+     *         than {@code 0} if {@code x < y} as unsigned values; and
+     *         a value greater than {@code 0} if {@code x > y} as
+     *         unsigned values
+     * @since 9
+     */
+    public static int compareUnsigned(byte x, byte y) {
+        return Byte.toUnsignedInt(x) - Byte.toUnsignedInt(y);
+    }
+
+    /**
      * Converts the argument to an {@code int} by an unsigned
      * conversion.  In an unsigned conversion to an {@code int}, the
      * high-order 24 bits of the {@code int} are zero and the
--- a/src/java.base/share/classes/java/lang/Deprecated.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/src/java.base/share/classes/java/lang/Deprecated.java	Mon Nov 09 09:05:20 2015 -0800
@@ -36,7 +36,7 @@
  *
  * <p>Use of the &#64;Deprecated annotation on a local variable
  * declaration or on a parameter declaration or a package declaration
- * has no effect.
+ * has no effect on the warnings issued by a compiler.
  *
  * @author  Neal Gafter
  * @since 1.5
--- a/src/java.base/share/classes/java/lang/Process.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/src/java.base/share/classes/java/lang/Process.java	Mon Nov 09 09:05:20 2015 -0800
@@ -83,7 +83,7 @@
  * {@link #getPid() process id},
  * {@link #info() information about the process},
  * {@link #children() direct children}, and
- * {@link #allChildren() direct and indirect children} of the process.
+ * {@link #descendants() direct children plus descendants of those children} of the process.
  * Delegating to the underlying Process or ProcessHandle is typically
  * easiest and most efficient.
  *
@@ -351,7 +351,7 @@
      * The {@link java.util.concurrent.CompletableFuture} provides the ability
      * to trigger dependent functions or actions that may be run synchronously
      * or asynchronously upon process termination.
-     * When the process terminates the CompletableFuture is
+     * When the process has terminated the CompletableFuture is
      * {@link java.util.concurrent.CompletableFuture#complete completed} regardless
      * of the exit status of the process.
      * <p>
@@ -362,9 +362,6 @@
      * {@link java.util.concurrent.CompletableFuture#cancel(boolean) Cancelling}
      * the CompletableFuture does not affect the Process.
      * <p>
-     * If the process is {@link #isAlive not alive} the {@link CompletableFuture}
-     * returned has been {@link java.util.concurrent.CompletableFuture#complete completed}.
-     * <p>
      * Processes returned from {@link ProcessBuilder#start} override the
      * default implementation to provide an efficient mechanism to wait
      * for process exit.
@@ -406,6 +403,9 @@
      *       return delegate.onExit().thenApply(p -> this);
      *    }
      * }</pre>
+     * @apiNote
+     * The process may be observed to have terminated with {@link #isAlive}
+     * before the ComputableFuture is completed and dependent actions are invoked.
      *
      * @return a new {@code CompletableFuture<Process>} for the Process
      *
@@ -464,7 +464,7 @@
      * {@link java.lang.UnsupportedOperationException} and performs no other action.
      * Subclasses should override this method to provide a ProcessHandle for the
      * process.  The methods {@link #getPid}, {@link #info}, {@link #children},
-     * and {@link #allChildren}, unless overridden, operate on the ProcessHandle.
+     * and {@link #descendants}, unless overridden, operate on the ProcessHandle.
      *
      * @return Returns a ProcessHandle for the Process
      * @throws UnsupportedOperationException if the Process implementation
@@ -481,9 +481,8 @@
     /**
      * Returns a snapshot of information about the process.
      *
-     * <p> An {@link ProcessHandle.Info} instance has various accessor methods
-     * that return information about the process, if the process is alive and
-     * the information is available, otherwise {@code null} is returned.
+     * <p> A {@link ProcessHandle.Info} instance has accessor methods
+     * that return information about the process if it is available.
      *
      * @implSpec
      * This implementation returns information about the process as:
@@ -524,9 +523,9 @@
     }
 
     /**
-     * Returns a snapshot of the direct and indirect children of the process.
-     * An indirect child is one whose parent is either a direct child or
-     * another indirect child.
+     * Returns a snapshot of the descendants of the process.
+     * The descendants of a process are the children of the process
+     * plus the descendants of those children, recursively.
      * Typically, a process that is {@link #isAlive not alive} has no children.
      * <p>
      * <em>Note that processes are created and terminate asynchronously.
@@ -535,18 +534,18 @@
      *
      * @implSpec
      * This implementation returns all children as:
-     * {@link #toHandle toHandle().allChildren()}.
+     * {@link #toHandle toHandle().descendants()}.
      *
-     * @return a sequential Stream of ProcessHandles for processes that are
-     *         direct and indirect children of the process
+     * @return a sequential Stream of ProcessHandles for processes that
+     *         are descendants of the process
      * @throws UnsupportedOperationException if the Process implementation
      *         does not support this operation
      * @throws SecurityException if a security manager has been installed and
      *         it denies RuntimePermission("manageProcess")
      * @since 1.9
      */
-    public Stream<ProcessHandle> allChildren() {
-        return toHandle().allChildren();
+    public Stream<ProcessHandle> descendants() {
+        return toHandle().descendants();
     }
 
 
--- a/src/java.base/share/classes/java/lang/ProcessHandle.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/src/java.base/share/classes/java/lang/ProcessHandle.java	Mon Nov 09 09:05:20 2015 -0800
@@ -54,7 +54,7 @@
  * Each ProcessHandle identifies and allows control of a process in the native
  * system. ProcessHandles are returned from the factory methods {@link #current()},
  * {@link #of(long)},
- * {@link #children}, {@link #allChildren}, {@link #parent()} and
+ * {@link #children}, {@link #descendants}, {@link #parent()} and
  * {@link #allProcesses()}.
  * <p>
  * The {@link Process} instances created by {@link ProcessBuilder} can be queried
@@ -164,21 +164,21 @@
     Stream<ProcessHandle> children();
 
     /**
-     * Returns a snapshot of the current direct and indirect children of the process.
-     * An indirect child is one whose parent is either a direct child or
-     * another indirect child.
+     * Returns a snapshot of the descendants of the process.
+     * The descendants of a process are the children of the process
+     * plus the descendants of those children, recursively.
      * Typically, a process that is {@link #isAlive not alive} has no children.
      * <p>
      * <em>Note that processes are created and terminate asynchronously.
      * There is no guarantee that a process is {@link #isAlive alive}.
      * </em>
      *
-     * @return a sequential Stream of ProcessHandles for processes that are
-     *         direct and indirect children of the process
+     * @return a sequential Stream of ProcessHandles for processes that
+     *         are descendants of the process
      * @throws SecurityException if a security manager has been installed and
      *         it denies RuntimePermission("manageProcess")
      */
-    Stream<ProcessHandle> allChildren();
+    Stream<ProcessHandle> descendants();
 
     /**
      * Returns a snapshot of all processes visible to the current process.
@@ -201,9 +201,8 @@
     /**
      * Returns a snapshot of information about the process.
      *
-     * <p> An {@code Info} instance has various accessor methods that return
-     * information about the process, if the process is alive and the
-     * information is available.
+     * <p> A {@link ProcessHandle.Info} instance has accessor methods that return
+     * information about the process if it is available.
      *
      * @return a snapshot of information about the process, always non-null
      */
@@ -288,7 +287,7 @@
      * The {@link java.util.concurrent.CompletableFuture} provides the ability
      * to trigger dependent functions or actions that may be run synchronously
      * or asynchronously upon process termination.
-     * When the process terminates the CompletableFuture is
+     * When the process has terminated the CompletableFuture is
      * {@link java.util.concurrent.CompletableFuture#complete completed} regardless
      * of the exit status of the process.
      * The {@code onExit} method can be called multiple times to invoke
@@ -300,9 +299,9 @@
      * {@link java.util.concurrent.Future#get() wait} for it to terminate.
      * {@link java.util.concurrent.Future#cancel(boolean) Cancelling}
      * the CompleteableFuture does not affect the Process.
-     * <p>
-     * If the process is {@link #isAlive not alive} the {@link CompletableFuture}
-     * returned has been {@link java.util.concurrent.CompletableFuture#complete completed}.
+     * @apiNote
+     * The process may be observed to have terminated with {@link #isAlive}
+     * before the ComputableFuture is completed and dependent actions are invoked.
      *
      * @return a new {@code CompletableFuture<ProcessHandle>} for the ProcessHandle
      *
--- a/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Mon Nov 09 09:05:20 2015 -0800
@@ -389,7 +389,7 @@
     }
 
     @Override
-    public Stream<ProcessHandle> allChildren() {
+    public Stream<ProcessHandle> descendants() {
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             sm.checkPermission(new RuntimePermission("manageProcess"));
--- a/src/java.base/share/classes/java/lang/Short.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/src/java.base/share/classes/java/lang/Short.java	Mon Nov 09 09:05:20 2015 -0800
@@ -468,6 +468,22 @@
     }
 
     /**
+     * Compares two {@code short} values numerically treating the values
+     * as unsigned.
+     *
+     * @param  x the first {@code short} to compare
+     * @param  y the second {@code short} to compare
+     * @return the value {@code 0} if {@code x == y}; a value less
+     *         than {@code 0} if {@code x < y} as unsigned values; and
+     *         a value greater than {@code 0} if {@code x > y} as
+     *         unsigned values
+     * @since 9
+     */
+    public static int compareUnsigned(short x, short y) {
+        return Short.toUnsignedInt(x) - Short.toUnsignedInt(y);
+    }
+
+    /**
      * The number of bits used to represent a {@code short} value in two's
      * complement binary form.
      * @since 1.5
--- a/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java	Mon Nov 09 09:05:20 2015 -0800
@@ -34,14 +34,16 @@
 import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.reflect.Field;
 import java.util.Arrays;
-import java.util.HashMap;
+import java.util.function.Function;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
 
+import jdk.internal.org.objectweb.asm.FieldVisitor;
 import sun.invoke.util.ValueConversions;
 import sun.invoke.util.Wrapper;
 
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.internal.org.objectweb.asm.MethodVisitor;
-import jdk.internal.org.objectweb.asm.Type;
 
 /**
  * The flavor of method handle which emulates an invoke instruction
@@ -217,7 +219,7 @@
         /*non-public*/ int fieldCount() {
             return 1;
         }
-        /*non-public*/ static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("L", Species_L.class);
+        /*non-public*/ static final SpeciesData SPECIES_DATA = new SpeciesData("L", Species_L.class);
         /*non-public*/ static BoundMethodHandle make(MethodType mt, LambdaForm lf, Object argL0) {
             return new Species_L(mt, lf, argL0);
         }
@@ -335,7 +337,7 @@
 
         static final SpeciesData EMPTY = new SpeciesData("", BoundMethodHandle.class);
 
-        private SpeciesData(String types, Class<? extends BoundMethodHandle> clazz) {
+        SpeciesData(String types, Class<? extends BoundMethodHandle> clazz) {
             this.typeChars = types;
             this.typeCodes = basicTypes(types);
             this.clazz = clazz;
@@ -355,26 +357,14 @@
             assert(!INIT_DONE);
             if (constructor() == null) {
                 String types = typeChars;
+                CACHE.put(types, this);
                 Factory.makeCtors(clazz, types, this.constructor);
                 Factory.makeGetters(clazz, types, this.getters);
                 Factory.makeNominalGetters(types, this.nominalGetters, this.getters);
             }
         }
 
-        private SpeciesData(String typeChars) {
-            // Placeholder only.
-            this.typeChars = typeChars;
-            this.typeCodes = basicTypes(typeChars);
-            this.clazz = null;
-            this.constructor = null;
-            this.getters = null;
-            this.nominalGetters = null;
-            this.extensions = null;
-        }
-        private boolean isPlaceholder() { return clazz == null; }
-
-        private static final HashMap<String, SpeciesData> CACHE = new HashMap<>();
-        static { CACHE.put("", EMPTY); }  // make bootstrap predictable
+        private static final ConcurrentMap<String, SpeciesData> CACHE = new ConcurrentHashMap<>();
         private static final boolean INIT_DONE;  // set after <clinit> finishes...
 
         SpeciesData extendWith(byte type) {
@@ -390,62 +380,52 @@
         }
 
         private static SpeciesData get(String types) {
-            // Acquire cache lock for query.
-            SpeciesData d = lookupCache(types);
-            if (!d.isPlaceholder())
-                return d;
-            synchronized (d) {
-                // Use synch. on the placeholder to prevent multiple instantiation of one species.
-                // Creating this class forces a recursive call to getForClass.
-                if (lookupCache(types).isPlaceholder())
-                    Factory.generateConcreteBMHClass(types);
-            }
-            // Reacquire cache lock.
-            d = lookupCache(types);
-            // Class loading must have upgraded the cache.
-            assert(d != null && !d.isPlaceholder());
-            return d;
-        }
-        static SpeciesData getForClass(String types, Class<? extends BoundMethodHandle> clazz) {
-            // clazz is a new class which is initializing its SPECIES_DATA field
-            return updateCache(types, new SpeciesData(types, clazz));
-        }
-        private static synchronized SpeciesData lookupCache(String types) {
-            SpeciesData d = CACHE.get(types);
-            if (d != null)  return d;
-            d = new SpeciesData(types);
-            assert(d.isPlaceholder());
-            CACHE.put(types, d);
-            return d;
-        }
-        private static synchronized SpeciesData updateCache(String types, SpeciesData d) {
-            SpeciesData d2;
-            assert((d2 = CACHE.get(types)) == null || d2.isPlaceholder());
-            assert(!d.isPlaceholder());
-            CACHE.put(types, d);
-            return d;
+            return CACHE.computeIfAbsent(types, new Function<String, SpeciesData>() {
+                @Override
+                public SpeciesData apply(String types) {
+                    Class<? extends BoundMethodHandle> bmhcl = Factory.getConcreteBMHClass(types);
+                    // SpeciesData instantiation may throw VirtualMachineError because of
+                    // code cache overflow...
+                    SpeciesData speciesData = new SpeciesData(types, bmhcl);
+                    // CHM.computeIfAbsent ensures only one SpeciesData will be set
+                    // successfully on the concrete BMH class if ever
+                    Factory.setSpeciesDataToConcreteBMHClass(bmhcl, speciesData);
+                    // the concrete BMH class is published via SpeciesData instance
+                    // returned here only after it's SPECIES_DATA field is set
+                    return speciesData;
+                }
+            });
         }
 
-        static {
-            // pre-fill the BMH speciesdata cache with BMH's inner classes
-            final Class<BoundMethodHandle> rootCls = BoundMethodHandle.class;
+        /**
+         * This is to be called when assertions are enabled. It checks whether SpeciesData for all of the statically
+         * defined species subclasses of BoundMethodHandle has been added to the SpeciesData cache. See below in the
+         * static initializer for
+         */
+        static boolean speciesDataCachePopulated() {
+            Class<BoundMethodHandle> rootCls = BoundMethodHandle.class;
             try {
                 for (Class<?> c : rootCls.getDeclaredClasses()) {
                     if (rootCls.isAssignableFrom(c)) {
                         final Class<? extends BoundMethodHandle> cbmh = c.asSubclass(BoundMethodHandle.class);
-                        SpeciesData d = Factory.speciesDataFromConcreteBMHClass(cbmh);
+                        SpeciesData d = Factory.getSpeciesDataFromConcreteBMHClass(cbmh);
                         assert(d != null) : cbmh.getName();
                         assert(d.clazz == cbmh);
-                        assert(d == lookupCache(d.typeChars));
+                        assert(CACHE.get(d.typeChars) == d);
                     }
                 }
             } catch (Throwable e) {
                 throw newInternalError(e);
             }
+            return true;
+        }
 
-            for (SpeciesData d : CACHE.values()) {
-                d.initForBootstrap();
-            }
+        static {
+            // Pre-fill the BMH species-data cache with EMPTY and all BMH's inner subclasses.
+            EMPTY.initForBootstrap();
+            Species_L.SPECIES_DATA.initForBootstrap();
+            // check that all static SpeciesData instances have been initialized
+            assert speciesDataCachePopulated();
             // Note:  Do not simplify this, because INIT_DONE must not be
             // a compile-time constant during bootstrapping.
             INIT_DONE = Boolean.TRUE;
@@ -479,6 +459,7 @@
         static final String BMH_SIG  = "L"+BMH+";";
         static final String SPECIES_DATA     = "java/lang/invoke/BoundMethodHandle$SpeciesData";
         static final String SPECIES_DATA_SIG = "L"+SPECIES_DATA+";";
+        static final String STABLE_SIG       = "Ljava/lang/invoke/Stable;";
 
         static final String SPECIES_PREFIX_NAME = "Species_";
         static final String SPECIES_PREFIX_PATH = BMH + "$" + SPECIES_PREFIX_NAME;
@@ -493,6 +474,26 @@
 
         static final String[] E_THROWABLE = new String[] { "java/lang/Throwable" };
 
+        static final ConcurrentMap<String, Class<? extends BoundMethodHandle>> CLASS_CACHE = new ConcurrentHashMap<>();
+
+        /**
+         * Get a concrete subclass of BMH for a given combination of bound types.
+         *
+         * @param types the type signature, wherein reference types are erased to 'L'
+         * @return the concrete BMH class
+         */
+        static Class<? extends BoundMethodHandle> getConcreteBMHClass(String types) {
+            // CHM.computeIfAbsent ensures generateConcreteBMHClass is called
+            // only once per key.
+            return CLASS_CACHE.computeIfAbsent(
+                types, new Function<String, Class<? extends BoundMethodHandle>>() {
+                    @Override
+                    public Class<? extends BoundMethodHandle> apply(String types) {
+                        return generateConcreteBMHClass(types);
+                    }
+                });
+        }
+
         /**
          * Generate a concrete subclass of BMH for a given combination of bound types.
          *
@@ -529,7 +530,7 @@
          *     }
          *     final SpeciesData speciesData() { return SPECIES_DATA; }
          *     final int fieldCount() { return 3; }
-         *     static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("LLI", Species_LLI.class);
+         *     &#64;Stable static SpeciesData SPECIES_DATA; // injected afterwards
          *     static BoundMethodHandle make(MethodType mt, LambdaForm lf, Object argL0, Object argL1, int argI2) {
          *         return new Species_LLI(mt, lf, argL0, argL1, argI2);
          *     }
@@ -568,7 +569,9 @@
             cw.visitSource(sourceFile, null);
 
             // emit static types and SPECIES_DATA fields
-            cw.visitField(NOT_ACC_PUBLIC + ACC_STATIC, "SPECIES_DATA", SPECIES_DATA_SIG, null, null).visitEnd();
+            FieldVisitor fw = cw.visitField(NOT_ACC_PUBLIC + ACC_STATIC, "SPECIES_DATA", SPECIES_DATA_SIG, null, null);
+            fw.visitAnnotation(STABLE_SIG, true);
+            fw.visitEnd();
 
             // emit bound argument fields
             for (int i = 0; i < types.length(); ++i) {
@@ -694,17 +697,6 @@
                 mv.visitEnd();
             }
 
-            // emit class initializer
-            mv = cw.visitMethod(NOT_ACC_PUBLIC | ACC_STATIC, "<clinit>", VOID_SIG, null, null);
-            mv.visitCode();
-            mv.visitLdcInsn(types);
-            mv.visitLdcInsn(Type.getObjectType(className));
-            mv.visitMethodInsn(INVOKESTATIC, SPECIES_DATA, "getForClass", BMHSPECIES_DATA_GFC_SIG, false);
-            mv.visitFieldInsn(PUTSTATIC, className, "SPECIES_DATA", SPECIES_DATA_SIG);
-            mv.visitInsn(RETURN);
-            mv.visitMaxs(0, 0);
-            mv.visitEnd();
-
             cw.visitEnd();
 
             // load class
@@ -715,7 +707,6 @@
                 UNSAFE.defineClass(className, classFile, 0, classFile.length,
                                    BoundMethodHandle.class.getClassLoader(), null)
                     .asSubclass(BoundMethodHandle.class);
-            UNSAFE.ensureClassInitialized(bmhClass);
 
             return bmhClass;
         }
@@ -785,7 +776,7 @@
         // Auxiliary methods.
         //
 
-        static SpeciesData speciesDataFromConcreteBMHClass(Class<? extends BoundMethodHandle> cbmh) {
+        static SpeciesData getSpeciesDataFromConcreteBMHClass(Class<? extends BoundMethodHandle> cbmh) {
             try {
                 Field F_SPECIES_DATA = cbmh.getDeclaredField("SPECIES_DATA");
                 return (SpeciesData) F_SPECIES_DATA.get(null);
@@ -794,6 +785,16 @@
             }
         }
 
+        static void setSpeciesDataToConcreteBMHClass(Class<? extends BoundMethodHandle> cbmh, SpeciesData speciesData) {
+            try {
+                Field F_SPECIES_DATA = cbmh.getDeclaredField("SPECIES_DATA");
+                assert F_SPECIES_DATA.getDeclaredAnnotation(Stable.class) != null;
+                F_SPECIES_DATA.set(null, speciesData);
+            } catch (ReflectiveOperationException ex) {
+                throw newInternalError(ex);
+            }
+        }
+
         /**
          * Field names in concrete BMHs adhere to this pattern:
          * arg + type + index
--- a/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java	Mon Nov 09 09:05:20 2015 -0800
@@ -66,15 +66,15 @@
     private static final String NAME_METHOD_WRITE_REPLACE = "writeReplace";
     private static final String NAME_METHOD_READ_OBJECT = "readObject";
     private static final String NAME_METHOD_WRITE_OBJECT = "writeObject";
+
+    private static final String DESCR_CLASS = "Ljava/lang/Class;";
+    private static final String DESCR_STRING = "Ljava/lang/String;";
+    private static final String DESCR_OBJECT = "Ljava/lang/Object;";
     private static final String DESCR_CTOR_SERIALIZED_LAMBDA
-            = MethodType.methodType(void.class,
-                                    Class.class,
-                                    String.class, String.class, String.class,
-                                    int.class, String.class, String.class, String.class,
-                                    String.class,
-                                    Object[].class).toMethodDescriptorString();
-    private static final String DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION
-            = MethodType.methodType(void.class, String.class).toMethodDescriptorString();
+            = "(" + DESCR_CLASS + DESCR_STRING + DESCR_STRING + DESCR_STRING + "I"
+            + DESCR_STRING + DESCR_STRING + DESCR_STRING + DESCR_STRING + "[" + DESCR_OBJECT + ")V";
+
+    private static final String DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION = "(Ljava/lang/String;)V";
     private static final String[] SER_HOSTILE_EXCEPTIONS = new String[] {NAME_NOT_SERIALIZABLE_EXCEPTION};
 
 
--- a/src/java.base/share/classes/java/lang/invoke/MemberName.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/src/java.base/share/classes/java/lang/invoke/MemberName.java	Mon Nov 09 09:05:20 2015 -0800
@@ -694,8 +694,11 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(clazz, getReferenceKind(), name, getType());
+        // Avoid autoboxing getReferenceKind(), since this is used early and will force
+        // early initialization of Byte$ByteCache
+        return Objects.hash(clazz, new Byte(getReferenceKind()), name, getType());
     }
+
     @Override
     public boolean equals(Object that) {
         return (that instanceof MemberName && this.equals((MemberName)that));
--- a/src/java.base/share/classes/java/lang/invoke/MethodType.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/src/java.base/share/classes/java/lang/invoke/MethodType.java	Mon Nov 09 09:05:20 2015 -0800
@@ -1187,20 +1187,23 @@
         // store them into the implementation-specific final fields.
         checkRtype(rtype);
         checkPtypes(ptypes);
-        UNSAFE.putObject(this, rtypeOffset, rtype);
-        UNSAFE.putObject(this, ptypesOffset, ptypes);
+        UNSAFE.putObject(this, OffsetHolder.rtypeOffset, rtype);
+        UNSAFE.putObject(this, OffsetHolder.ptypesOffset, ptypes);
     }
 
-    // Support for resetting final fields while deserializing
-    private static final long rtypeOffset, ptypesOffset;
-    static {
-        try {
-            rtypeOffset = UNSAFE.objectFieldOffset
-                (MethodType.class.getDeclaredField("rtype"));
-            ptypesOffset = UNSAFE.objectFieldOffset
-                (MethodType.class.getDeclaredField("ptypes"));
-        } catch (Exception ex) {
-            throw new Error(ex);
+    // Support for resetting final fields while deserializing. Implement Holder
+    // pattern to make the rarely needed offset calculation lazy.
+    private static class OffsetHolder {
+        private static final long rtypeOffset, ptypesOffset;
+        static {
+            try {
+                rtypeOffset = UNSAFE.objectFieldOffset
+                    (MethodType.class.getDeclaredField("rtype"));
+                ptypesOffset = UNSAFE.objectFieldOffset
+                    (MethodType.class.getDeclaredField("ptypes"));
+            } catch (Exception ex) {
+                throw new Error(ex);
+            }
         }
     }
 
--- a/src/java.base/share/classes/java/util/Arrays.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/src/java.base/share/classes/java/util/Arrays.java	Mon Nov 09 09:05:20 2015 -0800
@@ -25,6 +25,8 @@
 
 package java.util;
 
+import jdk.internal.HotSpotIntrinsicCandidate;
+
 import java.lang.reflect.Array;
 import java.util.concurrent.ForkJoinPool;
 import java.util.function.BinaryOperator;
@@ -42,7 +44,6 @@
 import java.util.stream.LongStream;
 import java.util.stream.Stream;
 import java.util.stream.StreamSupport;
-import jdk.internal.HotSpotIntrinsicCandidate;
 
 /**
  * This class contains various methods for manipulating arrays (such as
@@ -2586,6 +2587,55 @@
     }
 
     /**
+     * Returns true if the two specified arrays of longs, over the specified
+     * ranges, are <i>equal</i> to one another.
+     *
+     * <p>Two arrays are considered equal if the number of elements covered by
+     * each range is the same, and all corresponding pairs of elements over the
+     * specified ranges in the two arrays are equal.  In other words, two arrays
+     * are equal if they contain, over the specified ranges, the same elements
+     * in the same order.
+     *
+     * @param a the first array to be tested for equality
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested fro equality
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return {@code true} if the two arrays, over the specified ranges, are
+     *         equal
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static boolean equals(long[] a, int aFromIndex, int aToIndex,
+                                 long[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        if (aLength != bLength)
+            return false;
+
+        for (int i = 0; i < aLength; i++)
+            if (a[aFromIndex++] != b[bFromIndex++])
+                return false;
+
+        return true;
+    }
+
+    /**
      * Returns {@code true} if the two specified arrays of ints are
      * <i>equal</i> to one another.  Two arrays are considered equal if both
      * arrays contain the same number of elements, and all corresponding pairs
@@ -2615,6 +2665,55 @@
     }
 
     /**
+     * Returns true if the two specified arrays of ints, over the specified
+     * ranges, are <i>equal</i> to one another.
+     *
+     * <p>Two arrays are considered equal if the number of elements covered by
+     * each range is the same, and all corresponding pairs of elements over the
+     * specified ranges in the two arrays are equal.  In other words, two arrays
+     * are equal if they contain, over the specified ranges, the same elements
+     * in the same order.
+     *
+     * @param a the first array to be tested for equality
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested fro equality
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return {@code true} if the two arrays, over the specified ranges, are
+     *         equal
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static boolean equals(int[] a, int aFromIndex, int aToIndex,
+                                 int[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        if (aLength != bLength)
+            return false;
+
+        for (int i = 0; i < aLength; i++)
+            if (a[aFromIndex++] != b[bFromIndex++])
+                return false;
+
+        return true;
+    }
+
+    /**
      * Returns {@code true} if the two specified arrays of shorts are
      * <i>equal</i> to one another.  Two arrays are considered equal if both
      * arrays contain the same number of elements, and all corresponding pairs
@@ -2644,6 +2743,55 @@
     }
 
     /**
+     * Returns true if the two specified arrays of shorts, over the specified
+     * ranges, are <i>equal</i> to one another.
+     *
+     * <p>Two arrays are considered equal if the number of elements covered by
+     * each range is the same, and all corresponding pairs of elements over the
+     * specified ranges in the two arrays are equal.  In other words, two arrays
+     * are equal if they contain, over the specified ranges, the same elements
+     * in the same order.
+     *
+     * @param a the first array to be tested for equality
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested fro equality
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return {@code true} if the two arrays, over the specified ranges, are
+     *         equal
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static boolean equals(short[] a, int aFromIndex, int aToIndex,
+                                 short[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        if (aLength != bLength)
+            return false;
+
+        for (int i = 0; i < aLength; i++)
+            if (a[aFromIndex++] != b[bFromIndex++])
+                return false;
+
+        return true;
+    }
+
+    /**
      * Returns {@code true} if the two specified arrays of chars are
      * <i>equal</i> to one another.  Two arrays are considered equal if both
      * arrays contain the same number of elements, and all corresponding pairs
@@ -2674,6 +2822,55 @@
     }
 
     /**
+     * Returns true if the two specified arrays of chars, over the specified
+     * ranges, are <i>equal</i> to one another.
+     *
+     * <p>Two arrays are considered equal if the number of elements covered by
+     * each range is the same, and all corresponding pairs of elements over the
+     * specified ranges in the two arrays are equal.  In other words, two arrays
+     * are equal if they contain, over the specified ranges, the same elements
+     * in the same order.
+     *
+     * @param a the first array to be tested for equality
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested fro equality
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return {@code true} if the two arrays, over the specified ranges, are
+     *         equal
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static boolean equals(char[] a, int aFromIndex, int aToIndex,
+                                 char[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        if (aLength != bLength)
+            return false;
+
+        for (int i = 0; i < aLength; i++)
+            if (a[aFromIndex++] != b[bFromIndex++])
+                return false;
+
+        return true;
+    }
+
+    /**
      * Returns {@code true} if the two specified arrays of bytes are
      * <i>equal</i> to one another.  Two arrays are considered equal if both
      * arrays contain the same number of elements, and all corresponding pairs
@@ -2703,6 +2900,55 @@
     }
 
     /**
+     * Returns true if the two specified arrays of bytes, over the specified
+     * ranges, are <i>equal</i> to one another.
+     *
+     * <p>Two arrays are considered equal if the number of elements covered by
+     * each range is the same, and all corresponding pairs of elements over the
+     * specified ranges in the two arrays are equal.  In other words, two arrays
+     * are equal if they contain, over the specified ranges, the same elements
+     * in the same order.
+     *
+     * @param a the first array to be tested for equality
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested fro equality
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return {@code true} if the two arrays, over the specified ranges, are
+     *         equal
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static boolean equals(byte[] a, int aFromIndex, int aToIndex,
+                                 byte[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        if (aLength != bLength)
+            return false;
+
+        for (int i = 0; i < aLength; i++)
+            if (a[aFromIndex++] != b[bFromIndex++])
+                return false;
+
+        return true;
+    }
+
+    /**
      * Returns {@code true} if the two specified arrays of booleans are
      * <i>equal</i> to one another.  Two arrays are considered equal if both
      * arrays contain the same number of elements, and all corresponding pairs
@@ -2732,6 +2978,55 @@
     }
 
     /**
+     * Returns true if the two specified arrays of booleans, over the specified
+     * ranges, are <i>equal</i> to one another.
+     *
+     * <p>Two arrays are considered equal if the number of elements covered by
+     * each range is the same, and all corresponding pairs of elements over the
+     * specified ranges in the two arrays are equal.  In other words, two arrays
+     * are equal if they contain, over the specified ranges, the same elements
+     * in the same order.
+     *
+     * @param a the first array to be tested for equality
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested fro equality
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return {@code true} if the two arrays, over the specified ranges, are
+     *         equal
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static boolean equals(boolean[] a, int aFromIndex, int aToIndex,
+                                 boolean[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        if (aLength != bLength)
+            return false;
+
+        for (int i = 0; i < aLength; i++)
+            if (a[aFromIndex++] != b[bFromIndex++])
+                return false;
+
+        return true;
+    }
+
+    /**
      * Returns {@code true} if the two specified arrays of doubles are
      * <i>equal</i> to one another.  Two arrays are considered equal if both
      * arrays contain the same number of elements, and all corresponding pairs
@@ -2759,9 +3054,70 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++)
-            if (Double.doubleToLongBits(a[i])!=Double.doubleToLongBits(a2[i]))
-                return false;
+        for (int i=0; i<length; i++) {
+            double v1 = a[i], v2 = a2[i];
+            if (Double.doubleToRawLongBits(v1) != Double.doubleToRawLongBits(v2))
+                if (!Double.isNaN(v1) || !Double.isNaN(v2))
+                    return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Returns true if the two specified arrays of doubles, over the specified
+     * ranges, are <i>equal</i> to one another.
+     *
+     * <p>Two arrays are considered equal if the number of elements covered by
+     * each range is the same, and all corresponding pairs of elements over the
+     * specified ranges in the two arrays are equal.  In other words, two arrays
+     * are equal if they contain, over the specified ranges, the same elements
+     * in the same order.
+     *
+     * <p>Two doubles {@code d1} and {@code d2} are considered equal if:
+     * <pre>    {@code new Double(d1).equals(new Double(d2))}</pre>
+     * (Unlike the {@code ==} operator, this method considers
+     * {@code NaN} equals to itself, and 0.0d unequal to -0.0d.)
+     *
+     * @param a the first array to be tested for equality
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested fro equality
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return {@code true} if the two arrays, over the specified ranges, are
+     *         equal
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @see Double#equals(Object)
+     * @since 9
+     */
+    public static boolean equals(double[] a, int aFromIndex, int aToIndex,
+                                 double[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        if (aLength != bLength)
+            return false;
+
+        for (int i = 0; i < aLength; i++) {
+            Double va = a[aFromIndex++], vb = b[bFromIndex++];
+            if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb))
+                if (!Double.isNaN(va) || !Double.isNaN(vb))
+                    return false;
+        }
 
         return true;
     }
@@ -2794,9 +3150,70 @@
         if (a2.length != length)
             return false;
 
-        for (int i=0; i<length; i++)
-            if (Float.floatToIntBits(a[i])!=Float.floatToIntBits(a2[i]))
-                return false;
+        for (int i=0; i<length; i++) {
+            float v1 = a[i], v2 = a2[i];
+            if (Float.floatToRawIntBits(v1) != Float.floatToRawIntBits(v2))
+                if (!Float.isNaN(v1) || !Float.isNaN(v2))
+                    return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Returns true if the two specified arrays of floats, over the specified
+     * ranges, are <i>equal</i> to one another.
+     *
+     * <p>Two arrays are considered equal if the number of elements covered by
+     * each range is the same, and all corresponding pairs of elements over the
+     * specified ranges in the two arrays are equal.  In other words, two arrays
+     * are equal if they contain, over the specified ranges, the same elements
+     * in the same order.
+     *
+     * <p>Two floats {@code f1} and {@code f2} are considered equal if:
+     * <pre>    {@code new Float(f1).equals(new Float(f2))}</pre>
+     * (Unlike the {@code ==} operator, this method considers
+     * {@code NaN} equals to itself, and 0.0f unequal to -0.0f.)
+     *
+     * @param a the first array to be tested for equality
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested fro equality
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return {@code true} if the two arrays, over the specified ranges, are
+     *         equal
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @see Float#equals(Object)
+     * @since 9
+     */
+    public static boolean equals(float[] a, int aFromIndex, int aToIndex,
+                                 float[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        if (aLength != bLength)
+            return false;
+
+        for (int i = 0; i < aLength; i++) {
+            float va = a[aFromIndex++], vb = b[bFromIndex++];
+            if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb))
+                if (!Float.isNaN(va) || !Float.isNaN(vb))
+                    return false;
+        }
 
         return true;
     }
@@ -2827,9 +3244,60 @@
             return false;
 
         for (int i=0; i<length; i++) {
-            Object o1 = a[i];
-            Object o2 = a2[i];
-            if (!(o1==null ? o2==null : o1.equals(o2)))
+            if (!Objects.equals(a[i], a2[i]))
+                return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Returns true if the two specified arrays of Objects, over the specified
+     * ranges, are <i>equal</i> to one another.
+     *
+     * <p>Two arrays are considered equal if the number of elements covered by
+     * each range is the same, and all corresponding pairs of elements over the
+     * specified ranges in the two arrays are equal.  In other words, two arrays
+     * are equal if they contain, over the specified ranges, the same elements
+     * in the same order.
+     *
+     * <p>Two objects {@code e1} and {@code e2} are considered <i>equal</i> if
+     * {@code Objects.equals(e1, e2)}.
+     *
+     * @param a the first array to be tested for equality
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested fro equality
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return {@code true} if the two arrays, over the specified ranges, are
+     *         equal
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static boolean equals(Object[] a, int aFromIndex, int aToIndex,
+                                 Object[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        if (aLength != bLength)
+            return false;
+
+        for (int i = 0; i < aLength; i++) {
+            if (!Objects.equals(a[aFromIndex++], b[bFromIndex++]))
                 return false;
         }
 
@@ -5185,4 +5653,3233 @@
     public static DoubleStream stream(double[] array, int startInclusive, int endExclusive) {
         return StreamSupport.doubleStream(spliterator(array, startInclusive, endExclusive), false);
     }
-}
+
+
+    // Comparison methods
+
+    // Compare boolean
+
+    /**
+     * Compares two {@code boolean} arrays lexicographically.
+     *
+     * <p>If the two arrays share a common prefix then the lexicographic
+     * comparison is the result of comparing two elements, as if by
+     * {@link Boolean#compare(boolean, boolean)}, at an index within the
+     * respective arrays that is the prefix length.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two array lengths.
+     * (See {@link #mismatch(boolean[], boolean[])} for the definition of a
+     * common and proper prefix.)
+     *
+     * <p>A {@code null} array reference is considered lexicographically less
+     * than a non-{@code null} array reference.  Two {@code null} array
+     * references are considered equal.
+     *
+     * <p>The comparison is consistent with {@link #equals(boolean[], boolean[]) equals},
+     * more specifically the following holds for arrays {@code a} and {@code b}:
+     * <pre>{@code
+     *     Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if (for non-{@code null} array references):
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, b);
+     *     if (i >= 0 && i < Math.min(a.length, b.length))
+     *         return Boolean.compare(a[i], b[i]);
+     *     return a.length - b.length;
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param b the second array to compare
+     * @return the value {@code 0} if the first and second array are equal and
+     *         contain the same elements in the same order;
+     *         a value less than {@code 0} if the first array is
+     *         lexicographically less than the second array; and
+     *         a value greater than {@code 0} if the first array is
+     *         lexicographically greater than the second array
+     * @since 9
+     */
+    public static int compare(boolean[] a, boolean[] b) {
+        if (a == b)
+            return 0;
+        if (a == null || b == null)
+            return a == null ? -1 : 1;
+
+        int length = Math.min(a.length, b.length);
+        for (int i = 0; i < length; i++) {
+            if (a[i] != b[i]) return Boolean.compare(a[i], b[i]);
+        }
+
+        return a.length - b.length;
+    }
+
+    /**
+     * Compares two {@code boolean} arrays lexicographically over the specified
+     * ranges.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the lexicographic comparison is the result of comparing two
+     * elements, as if by {@link Boolean#compare(boolean, boolean)}, at a
+     * relative index within the respective arrays that is the length of the
+     * prefix.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two range lengths.
+     * (See {@link #mismatch(boolean[], int, int, boolean[], int, int)} for the
+     * definition of a common and proper prefix.)
+     *
+     * <p>The comparison is consistent with
+     * {@link #equals(boolean[], int, int, boolean[], int, int) equals}, more
+     * specifically the following holds for arrays {@code a} and {@code b} with
+     * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively:
+     * <pre>{@code
+     *     Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+     *         (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if:
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+     *                             b, bFromIndex, bToIndex);
+     *     if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     *         return Boolean.compare(a[aFromIndex + i], b[bFromIndex + i]);
+     *     return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be compared
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be compared
+     * @param b the second array to compare
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be compared
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be compared
+     * @return the value {@code 0} if, over the specified ranges, the first and
+     *         second array are equal and contain the same elements in the same
+     *         order;
+     *         a value less than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically less than the second array; and
+     *         a value greater than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically greater than the second array
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int compare(boolean[] a, int aFromIndex, int aToIndex,
+                              boolean[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            boolean va = a[aFromIndex++];
+            boolean vb = b[bFromIndex++];
+            if (va != vb) return Boolean.compare(va, vb);
+        }
+
+        return aLength - bLength;
+    }
+
+    // Compare byte
+
+    /**
+     * Compares two {@code byte} arrays lexicographically.
+     *
+     * <p>If the two arrays share a common prefix then the lexicographic
+     * comparison is the result of comparing two elements, as if by
+     * {@link Byte#compare(byte, byte)}, at an index within the respective
+     * arrays that is the prefix length.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two array lengths.
+     * (See {@link #mismatch(byte[], byte[])} for the definition of a common and
+     * proper prefix.)
+     *
+     * <p>A {@code null} array reference is considered lexicographically less
+     * than a non-{@code null} array reference.  Two {@code null} array
+     * references are considered equal.
+     *
+     * <p>The comparison is consistent with {@link #equals(byte[], byte[]) equals},
+     * more specifically the following holds for arrays {@code a} and {@code b}:
+     * <pre>{@code
+     *     Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if (for non-{@code null} array references):
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, b);
+     *     if (i >= 0 && i < Math.min(a.length, b.length))
+     *         return Byte.compare(a[i], b[i]);
+     *     return a.length - b.length;
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param b the second array to compare
+     * @return the value {@code 0} if the first and second array are equal and
+     *         contain the same elements in the same order;
+     *         a value less than {@code 0} if the first array is
+     *         lexicographically less than the second array; and
+     *         a value greater than {@code 0} if the first array is
+     *         lexicographically greater than the second array
+     * @since 9
+     */
+    public static int compare(byte[] a, byte[] b) {
+        if (a == b)
+            return 0;
+        if (a == null || b == null)
+            return a == null ? -1 : 1;
+
+        int length = Math.min(a.length, b.length);
+        for (int i = 0; i < length; i++) {
+            if (a[i] != b[i]) return Byte.compare(a[i], b[i]);
+        }
+
+        return a.length - b.length;
+    }
+
+    /**
+     * Compares two {@code byte} arrays lexicographically over the specified
+     * ranges.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the lexicographic comparison is the result of comparing two
+     * elements, as if by {@link Byte#compare(byte, byte)}, at a relative index
+     * within the respective arrays that is the length of the prefix.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two range lengths.
+     * (See {@link #mismatch(byte[], int, int, byte[], int, int)} for the
+     * definition of a common and proper prefix.)
+     *
+     * <p>The comparison is consistent with
+     * {@link #equals(byte[], int, int, byte[], int, int) equals}, more
+     * specifically the following holds for arrays {@code a} and {@code b} with
+     * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively:
+     * <pre>{@code
+     *     Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+     *         (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if:
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+     *                             b, bFromIndex, bToIndex);
+     *     if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     *         return Byte.compare(a[aFromIndex + i], b[bFromIndex + i]);
+     *     return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be compared
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be compared
+     * @param b the second array to compare
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be compared
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be compared
+     * @return the value {@code 0} if, over the specified ranges, the first and
+     *         second array are equal and contain the same elements in the same
+     *         order;
+     *         a value less than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically less than the second array; and
+     *         a value greater than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically greater than the second array
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int compare(byte[] a, int aFromIndex, int aToIndex,
+                              byte[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            byte va = a[aFromIndex++];
+            byte vb = b[bFromIndex++];
+            if (va != vb) return Byte.compare(va, vb);
+        }
+
+        return aLength - bLength;
+    }
+
+    /**
+     * Compares two {@code byte} arrays lexicographically, numerically treating
+     * elements as unsigned.
+     *
+     * <p>If the two arrays share a common prefix then the lexicographic
+     * comparison is the result of comparing two elements, as if by
+     * {@link Byte#compareUnsigned(byte, byte)}, at an index within the
+     * respective arrays that is the prefix length.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two array lengths.
+     * (See {@link #mismatch(byte[], byte[])} for the definition of a common
+     * and proper prefix.)
+     *
+     * <p>A {@code null} array reference is considered lexicographically less
+     * than a non-{@code null} array reference.  Two {@code null} array
+     * references are considered equal.
+     *
+     * @apiNote
+     * <p>This method behaves as if (for non-{@code null} array references):
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, b);
+     *     if (i >= 0 && i < Math.min(a.length, b.length))
+     *         return Byte.compareUnsigned(a[i], b[i]);
+     *     return a.length - b.length;
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param b the second array to compare
+     * @return the value {@code 0} if the first and second array are
+     *         equal and contain the same elements in the same order;
+     *         a value less than {@code 0} if the first array is
+     *         lexicographically less than the second array; and
+     *         a value greater than {@code 0} if the first array is
+     *         lexicographically greater than the second array
+     * @since 9
+     */
+    public static int compareUnsigned(byte[] a, byte[] b) {
+        if (a == b)
+            return 0;
+        if (a == null || b == null)
+            return a == null ? -1 : 1;
+
+        int length = Math.min(a.length, b.length);
+        for (int i = 0; i < length; i++) {
+            if (a[i] != b[i]) return Byte.compareUnsigned(a[i], b[i]);
+        }
+
+        return a.length - b.length;
+    }
+
+
+    /**
+     * Compares two {@code byte} arrays lexicographically over the specified
+     * ranges, numerically treating elements as unsigned.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the lexicographic comparison is the result of comparing two
+     * elements, as if by {@link Byte#compareUnsigned(byte, byte)}, at a
+     * relative index within the respective arrays that is the length of the
+     * prefix.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two range lengths.
+     * (See {@link #mismatch(byte[], int, int, byte[], int, int)} for the
+     * definition of a common and proper prefix.)
+     *
+     * @apiNote
+     * <p>This method behaves as if:
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+     *                             b, bFromIndex, bToIndex);
+     *     if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     *         return Byte.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
+     *     return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be compared
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be compared
+     * @param b the second array to compare
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be compared
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be compared
+     * @return the value {@code 0} if, over the specified ranges, the first and
+     *         second array are equal and contain the same elements in the same
+     *         order;
+     *         a value less than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically less than the second array; and
+     *         a value greater than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically greater than the second array
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is null
+     * @since 9
+     */
+    public static int compareUnsigned(byte[] a, int aFromIndex, int aToIndex,
+                                      byte[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            byte va = a[aFromIndex++];
+            byte vb = b[bFromIndex++];
+            if (va != vb) return Byte.compareUnsigned(va, vb);
+        }
+
+        return aLength - bLength;
+    }
+
+    // Compare short
+
+    /**
+     * Compares two {@code short} arrays lexicographically.
+     *
+     * <p>If the two arrays share a common prefix then the lexicographic
+     * comparison is the result of comparing two elements, as if by
+     * {@link Short#compare(short, short)}, at an index within the respective
+     * arrays that is the prefix length.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two array lengths.
+     * (See {@link #mismatch(short[], short[])} for the definition of a common
+     * and proper prefix.)
+     *
+     * <p>A {@code null} array reference is considered lexicographically less
+     * than a non-{@code null} array reference.  Two {@code null} array
+     * references are considered equal.
+     *
+     * <p>The comparison is consistent with {@link #equals(short[], short[]) equals},
+     * more specifically the following holds for arrays {@code a} and {@code b}:
+     * <pre>{@code
+     *     Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if (for non-{@code null} array references):
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, b);
+     *     if (i >= 0 && i < Math.min(a.length, b.length))
+     *         return Short.compare(a[i], b[i]);
+     *     return a.length - b.length;
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param b the second array to compare
+     * @return the value {@code 0} if the first and second array are equal and
+     *         contain the same elements in the same order;
+     *         a value less than {@code 0} if the first array is
+     *         lexicographically less than the second array; and
+     *         a value greater than {@code 0} if the first array is
+     *         lexicographically greater than the second array
+     * @since 9
+     */
+    public static int compare(short[] a, short[] b) {
+        if (a == b)
+            return 0;
+        if (a == null || b == null)
+            return a == null ? -1 : 1;
+
+        int length = Math.min(a.length, b.length);
+        for (int i = 0; i < length; i++) {
+            if (a[i] != b[i]) return Short.compare(a[i], b[i]);
+        }
+
+        return a.length - b.length;
+    }
+
+    /**
+     * Compares two {@code short} arrays lexicographically over the specified
+     * ranges.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the lexicographic comparison is the result of comparing two
+     * elements, as if by {@link Short#compare(short, short)}, at a relative
+     * index within the respective arrays that is the length of the prefix.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two range lengths.
+     * (See {@link #mismatch(short[], int, int, short[], int, int)} for the
+     * definition of a common and proper prefix.)
+     *
+     * <p>The comparison is consistent with
+     * {@link #equals(short[], int, int, short[], int, int) equals}, more
+     * specifically the following holds for arrays {@code a} and {@code b} with
+     * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively:
+     * <pre>{@code
+     *     Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+     *         (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if:
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+     *                             b, bFromIndex, bToIndex);
+     *     if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     *         return Short.compare(a[aFromIndex + i], b[bFromIndex + i]);
+     *     return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be compared
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be compared
+     * @param b the second array to compare
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be compared
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be compared
+     * @return the value {@code 0} if, over the specified ranges, the first and
+     *         second array are equal and contain the same elements in the same
+     *         order;
+     *         a value less than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically less than the second array; and
+     *         a value greater than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically greater than the second array
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int compare(short[] a, int aFromIndex, int aToIndex,
+                              short[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            short va = a[aFromIndex++];
+            short vb = b[bFromIndex++];
+            if (va != vb) return Short.compare(va, vb);
+        }
+
+        return aLength - bLength;
+    }
+
+    /**
+     * Compares two {@code short} arrays lexicographically, numerically treating
+     * elements as unsigned.
+     *
+     * <p>If the two arrays share a common prefix then the lexicographic
+     * comparison is the result of comparing two elements, as if by
+     * {@link Short#compareUnsigned(short, short)}, at an index within the
+     * respective arrays that is the prefix length.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two array lengths.
+     * (See {@link #mismatch(short[], short[])} for the definition of a common
+     * and proper prefix.)
+     *
+     * <p>A {@code null} array reference is considered lexicographically less
+     * than a non-{@code null} array reference.  Two {@code null} array
+     * references are considered equal.
+     *
+     * @apiNote
+     * <p>This method behaves as if (for non-{@code null} array references):
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, b);
+     *     if (i >= 0 && i < Math.min(a.length, b.length))
+     *         return Short.compareUnsigned(a[i], b[i]);
+     *     return a.length - b.length;
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param b the second array to compare
+     * @return the value {@code 0} if the first and second array are
+     *         equal and contain the same elements in the same order;
+     *         a value less than {@code 0} if the first array is
+     *         lexicographically less than the second array; and
+     *         a value greater than {@code 0} if the first array is
+     *         lexicographically greater than the second array
+     * @since 9
+     */
+    public static int compareUnsigned(short[] a, short[] b) {
+        if (a == b)
+            return 0;
+        if (a == null || b == null)
+            return a == null ? -1 : 1;
+
+        int length = Math.min(a.length, b.length);
+        for (int i = 0; i < length; i++) {
+            if (a[i] != b[i]) return Short.compareUnsigned(a[i], b[i]);
+        }
+
+        return a.length - b.length;
+    }
+
+    /**
+     * Compares two {@code short} arrays lexicographically over the specified
+     * ranges, numerically treating elements as unsigned.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the lexicographic comparison is the result of comparing two
+     * elements, as if by {@link Short#compareUnsigned(short, short)}, at a
+     * relative index within the respective arrays that is the length of the
+     * prefix.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two range lengths.
+     * (See {@link #mismatch(short[], int, int, short[], int, int)} for the
+     * definition of a common and proper prefix.)
+     *
+     * @apiNote
+     * <p>This method behaves as if:
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+     *                             b, bFromIndex, bToIndex);
+     *     if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     *         return Short.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
+     *     return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be compared
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be compared
+     * @param b the second array to compare
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be compared
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be compared
+     * @return the value {@code 0} if, over the specified ranges, the first and
+     *         second array are equal and contain the same elements in the same
+     *         order;
+     *         a value less than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically less than the second array; and
+     *         a value greater than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically greater than the second array
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is null
+     * @since 9
+     */
+    public static int compareUnsigned(short[] a, int aFromIndex, int aToIndex,
+                                      short[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            short va = a[aFromIndex++];
+            short vb = b[bFromIndex++];
+            if (va != vb) return Short.compareUnsigned(va, vb);
+        }
+
+        return aLength - bLength;
+    }
+
+    // Compare char
+
+    /**
+     * Compares two {@code char} arrays lexicographically.
+     *
+     * <p>If the two arrays share a common prefix then the lexicographic
+     * comparison is the result of comparing two elements, as if by
+     * {@link Character#compare(char, char)}, at an index within the respective
+     * arrays that is the prefix length.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two array lengths.
+     * (See {@link #mismatch(char[], char[])} for the definition of a common and
+     * proper prefix.)
+     *
+     * <p>A {@code null} array reference is considered lexicographically less
+     * than a non-{@code null} array reference.  Two {@code null} array
+     * references are considered equal.
+     *
+     * <p>The comparison is consistent with {@link #equals(char[], char[]) equals},
+     * more specifically the following holds for arrays {@code a} and {@code b}:
+     * <pre>{@code
+     *     Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if (for non-{@code null} array references):
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, b);
+     *     if (i >= 0 && i < Math.min(a.length, b.length))
+     *         return Character.compare(a[i], b[i]);
+     *     return a.length - b.length;
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param b the second array to compare
+     * @return the value {@code 0} if the first and second array are equal and
+     *         contain the same elements in the same order;
+     *         a value less than {@code 0} if the first array is
+     *         lexicographically less than the second array; and
+     *         a value greater than {@code 0} if the first array is
+     *         lexicographically greater than the second array
+     * @since 9
+     */
+    public static int compare(char[] a, char[] b) {
+        if (a == b)
+            return 0;
+        if (a == null || b == null)
+            return a == null ? -1 : 1;
+
+        int length = Math.min(a.length, b.length);
+        for (int i = 0; i < length; i++) {
+            if (a[i] != b[i]) return Character.compare(a[i], b[i]);
+        }
+
+        return a.length - b.length;
+    }
+
+    /**
+     * Compares two {@code char} arrays lexicographically over the specified
+     * ranges.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the lexicographic comparison is the result of comparing two
+     * elements, as if by {@link Character#compare(char, char)}, at a relative
+     * index within the respective arrays that is the length of the prefix.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two range lengths.
+     * (See {@link #mismatch(char[], int, int, char[], int, int)} for the
+     * definition of a common and proper prefix.)
+     *
+     * <p>The comparison is consistent with
+     * {@link #equals(char[], int, int, char[], int, int) equals}, more
+     * specifically the following holds for arrays {@code a} and {@code b} with
+     * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively:
+     * <pre>{@code
+     *     Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+     *         (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if:
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+     *                             b, bFromIndex, bToIndex);
+     *     if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     *         return Character.compare(a[aFromIndex + i], b[bFromIndex + i]);
+     *     return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be compared
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be compared
+     * @param b the second array to compare
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be compared
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be compared
+     * @return the value {@code 0} if, over the specified ranges, the first and
+     *         second array are equal and contain the same elements in the same
+     *         order;
+     *         a value less than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically less than the second array; and
+     *         a value greater than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically greater than the second array
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int compare(char[] a, int aFromIndex, int aToIndex,
+                              char[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            char va = a[aFromIndex++];
+            char vb = b[bFromIndex++];
+            if (va != vb) return Character.compare(va, vb);
+        }
+
+        return aLength - bLength;
+    }
+
+    // Compare int
+
+    /**
+     * Compares two {@code int} arrays lexicographically.
+     *
+     * <p>If the two arrays share a common prefix then the lexicographic
+     * comparison is the result of comparing two elements, as if by
+     * {@link Integer#compare(int, int)}, at an index within the respective
+     * arrays that is the prefix length.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two array lengths.
+     * (See {@link #mismatch(int[], int[])} for the definition of a common and
+     * proper prefix.)
+     *
+     * <p>A {@code null} array reference is considered lexicographically less
+     * than a non-{@code null} array reference.  Two {@code null} array
+     * references are considered equal.
+     *
+     * <p>The comparison is consistent with {@link #equals(int[], int[]) equals},
+     * more specifically the following holds for arrays {@code a} and {@code b}:
+     * <pre>{@code
+     *     Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if (for non-{@code null} array references):
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, b);
+     *     if (i >= 0 && i < Math.min(a.length, b.length))
+     *         return Integer.compare(a[i], b[i]);
+     *     return a.length - b.length;
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param b the second array to compare
+     * @return the value {@code 0} if the first and second array are equal and
+     *         contain the same elements in the same order;
+     *         a value less than {@code 0} if the first array is
+     *         lexicographically less than the second array; and
+     *         a value greater than {@code 0} if the first array is
+     *         lexicographically greater than the second array
+     * @since 9
+     */
+    public static int compare(int[] a, int[] b) {
+        if (a == b)
+            return 0;
+        if (a == null || b == null)
+            return a == null ? -1 : 1;
+
+        int length = Math.min(a.length, b.length);
+        for (int i = 0; i < length; i++) {
+            if (a[i] != b[i]) return Integer.compare(a[i], b[i]);
+        }
+
+        return a.length - b.length;
+    }
+
+    /**
+     * Compares two {@code int} arrays lexicographically over the specified
+     * ranges.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the lexicographic comparison is the result of comparing two
+     * elements, as if by {@link Integer#compare(int, int)}, at a relative index
+     * within the respective arrays that is the length of the prefix.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two range lengths.
+     * (See {@link #mismatch(int[], int, int, int[], int, int)} for the
+     * definition of a common and proper prefix.)
+     *
+     * <p>The comparison is consistent with
+     * {@link #equals(int[], int, int, int[], int, int) equals}, more
+     * specifically the following holds for arrays {@code a} and {@code b} with
+     * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively:
+     * <pre>{@code
+     *     Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+     *         (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if:
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+     *                             b, bFromIndex, bToIndex);
+     *     if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     *         return Integer.compare(a[aFromIndex + i], b[bFromIndex + i]);
+     *     return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be compared
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be compared
+     * @param b the second array to compare
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be compared
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be compared
+     * @return the value {@code 0} if, over the specified ranges, the first and
+     *         second array are equal and contain the same elements in the same
+     *         order;
+     *         a value less than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically less than the second array; and
+     *         a value greater than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically greater than the second array
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int compare(int[] a, int aFromIndex, int aToIndex,
+                              int[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            int va = a[aFromIndex++];
+            int vb = b[bFromIndex++];
+            if (va != vb) return Integer.compare(va, vb);
+        }
+
+        return aLength - bLength;
+    }
+
+    /**
+     * Compares two {@code int} arrays lexicographically, numerically treating
+     * elements as unsigned.
+     *
+     * <p>If the two arrays share a common prefix then the lexicographic
+     * comparison is the result of comparing two elements, as if by
+     * {@link Integer#compareUnsigned(int, int)}, at an index within the
+     * respective arrays that is the prefix length.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two array lengths.
+     * (See {@link #mismatch(int[], int[])} for the definition of a common
+     * and proper prefix.)
+     *
+     * <p>A {@code null} array reference is considered lexicographically less
+     * than a non-{@code null} array reference.  Two {@code null} array
+     * references are considered equal.
+     *
+     * @apiNote
+     * <p>This method behaves as if (for non-{@code null} array references):
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, b);
+     *     if (i >= 0 && i < Math.min(a.length, b.length))
+     *         return Integer.compareUnsigned(a[i], b[i]);
+     *     return a.length - b.length;
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param b the second array to compare
+     * @return the value {@code 0} if the first and second array are
+     *         equal and contain the same elements in the same order;
+     *         a value less than {@code 0} if the first array is
+     *         lexicographically less than the second array; and
+     *         a value greater than {@code 0} if the first array is
+     *         lexicographically greater than the second array
+     * @since 9
+     */
+    public static int compareUnsigned(int[] a, int[] b) {
+        if (a == b)
+            return 0;
+        if (a == null || b == null)
+            return a == null ? -1 : 1;
+
+        int length = Math.min(a.length, b.length);
+        for (int i = 0; i < length; i++) {
+            if (a[i] != b[i]) return Integer.compareUnsigned(a[i], b[i]);
+        }
+
+        return a.length - b.length;
+    }
+
+    /**
+     * Compares two {@code int} arrays lexicographically over the specified
+     * ranges, numerically treating elements as unsigned.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the lexicographic comparison is the result of comparing two
+     * elements, as if by {@link Integer#compareUnsigned(int, int)}, at a
+     * relative index within the respective arrays that is the length of the
+     * prefix.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two range lengths.
+     * (See {@link #mismatch(int[], int, int, int[], int, int)} for the
+     * definition of a common and proper prefix.)
+     *
+     * @apiNote
+     * <p>This method behaves as if:
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+     *                             b, bFromIndex, bToIndex);
+     *     if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     *         return Integer.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
+     *     return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be compared
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be compared
+     * @param b the second array to compare
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be compared
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be compared
+     * @return the value {@code 0} if, over the specified ranges, the first and
+     *         second array are equal and contain the same elements in the same
+     *         order;
+     *         a value less than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically less than the second array; and
+     *         a value greater than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically greater than the second array
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is null
+     * @since 9
+     */
+    public static int compareUnsigned(int[] a, int aFromIndex, int aToIndex,
+                                      int[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            int va = a[aFromIndex++];
+            int vb = b[bFromIndex++];
+            if (va != vb) return Integer.compareUnsigned(va, vb);
+        }
+
+        return aLength - bLength;
+    }
+
+    // Compare long
+
+    /**
+     * Compares two {@code long} arrays lexicographically.
+     *
+     * <p>If the two arrays share a common prefix then the lexicographic
+     * comparison is the result of comparing two elements, as if by
+     * {@link Long#compare(long, long)}, at an index within the respective
+     * arrays that is the prefix length.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two array lengths.
+     * (See {@link #mismatch(long[], long[])} for the definition of a common and
+     * proper prefix.)
+     *
+     * <p>A {@code null} array reference is considered lexicographically less
+     * than a non-{@code null} array reference.  Two {@code null} array
+     * references are considered equal.
+     *
+     * <p>The comparison is consistent with {@link #equals(long[], long[]) equals},
+     * more specifically the following holds for arrays {@code a} and {@code b}:
+     * <pre>{@code
+     *     Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if (for non-{@code null} array references):
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, b);
+     *     if (i >= 0 && i < Math.min(a.length, b.length))
+     *         return Long.compare(a[i], b[i]);
+     *     return a.length - b.length;
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param b the second array to compare
+     * @return the value {@code 0} if the first and second array are equal and
+     *         contain the same elements in the same order;
+     *         a value less than {@code 0} if the first array is
+     *         lexicographically less than the second array; and
+     *         a value greater than {@code 0} if the first array is
+     *         lexicographically greater than the second array
+     * @since 9
+     */
+    public static int compare(long[] a, long[] b) {
+        if (a == b)
+            return 0;
+        if (a == null || b == null)
+            return a == null ? -1 : 1;
+
+        int length = Math.min(a.length, b.length);
+        for (int i = 0; i < length; i++) {
+            if (a[i] != b[i]) return Long.compare(a[i], b[i]);
+        }
+
+        return a.length - b.length;
+    }
+
+    /**
+     * Compares two {@code long} arrays lexicographically over the specified
+     * ranges.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the lexicographic comparison is the result of comparing two
+     * elements, as if by {@link Long#compare(long, long)}, at a relative index
+     * within the respective arrays that is the length of the prefix.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two range lengths.
+     * (See {@link #mismatch(long[], int, int, long[], int, int)} for the
+     * definition of a common and proper prefix.)
+     *
+     * <p>The comparison is consistent with
+     * {@link #equals(long[], int, int, long[], int, int) equals}, more
+     * specifically the following holds for arrays {@code a} and {@code b} with
+     * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively:
+     * <pre>{@code
+     *     Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+     *         (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if:
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+     *                             b, bFromIndex, bToIndex);
+     *     if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     *         return Long.compare(a[aFromIndex + i], b[bFromIndex + i]);
+     *     return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be compared
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be compared
+     * @param b the second array to compare
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be compared
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be compared
+     * @return the value {@code 0} if, over the specified ranges, the first and
+     *         second array are equal and contain the same elements in the same
+     *         order;
+     *         a value less than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically less than the second array; and
+     *         a value greater than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically greater than the second array
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int compare(long[] a, int aFromIndex, int aToIndex,
+                              long[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            long va = a[aFromIndex++];
+            long vb = b[bFromIndex++];
+            if (va != vb) return Long.compare(va, vb);
+        }
+
+        return aLength - bLength;
+    }
+
+    /**
+     * Compares two {@code long} arrays lexicographically, numerically treating
+     * elements as unsigned.
+     *
+     * <p>If the two arrays share a common prefix then the lexicographic
+     * comparison is the result of comparing two elements, as if by
+     * {@link Long#compareUnsigned(long, long)}, at an index within the
+     * respective arrays that is the prefix length.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two array lengths.
+     * (See {@link #mismatch(long[], long[])} for the definition of a common
+     * and proper prefix.)
+     *
+     * <p>A {@code null} array reference is considered lexicographically less
+     * than a non-{@code null} array reference.  Two {@code null} array
+     * references are considered equal.
+     *
+     * @apiNote
+     * <p>This method behaves as if (for non-{@code null} array references):
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, b);
+     *     if (i >= 0 && i < Math.min(a.length, b.length))
+     *         return Long.compareUnsigned(a[i], b[i]);
+     *     return a.length - b.length;
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param b the second array to compare
+     * @return the value {@code 0} if the first and second array are
+     *         equal and contain the same elements in the same order;
+     *         a value less than {@code 0} if the first array is
+     *         lexicographically less than the second array; and
+     *         a value greater than {@code 0} if the first array is
+     *         lexicographically greater than the second array
+     * @since 9
+     */
+    public static int compareUnsigned(long[] a, long[] b) {
+        if (a == b)
+            return 0;
+        if (a == null || b == null)
+            return a == null ? -1 : 1;
+
+        int length = Math.min(a.length, b.length);
+        for (int i = 0; i < length; i++) {
+            if (a[i] != b[i]) return Long.compareUnsigned(a[i], b[i]);
+        }
+
+        return a.length - b.length;
+    }
+
+    /**
+     * Compares two {@code long} arrays lexicographically over the specified
+     * ranges, numerically treating elements as unsigned.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the lexicographic comparison is the result of comparing two
+     * elements, as if by {@link Long#compareUnsigned(long, long)}, at a
+     * relative index within the respective arrays that is the length of the
+     * prefix.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two range lengths.
+     * (See {@link #mismatch(long[], int, int, long[], int, int)} for the
+     * definition of a common and proper prefix.)
+     *
+     * @apiNote
+     * <p>This method behaves as if:
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+     *                             b, bFromIndex, bToIndex);
+     *     if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     *         return Long.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
+     *     return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be compared
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be compared
+     * @param b the second array to compare
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be compared
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be compared
+     * @return the value {@code 0} if, over the specified ranges, the first and
+     *         second array are equal and contain the same elements in the same
+     *         order;
+     *         a value less than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically less than the second array; and
+     *         a value greater than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically greater than the second array
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is null
+     * @since 9
+     */
+    public static int compareUnsigned(long[] a, int aFromIndex, int aToIndex,
+                                      long[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            long va = a[aFromIndex++];
+            long vb = b[bFromIndex++];
+            if (va != vb) return Long.compareUnsigned(va, vb);
+        }
+
+        return aLength - bLength;
+    }
+
+    // Compare float
+
+    /**
+     * Compares two {@code float} arrays lexicographically.
+     *
+     * <p>If the two arrays share a common prefix then the lexicographic
+     * comparison is the result of comparing two elements, as if by
+     * {@link Float#compare(float, float)}, at an index within the respective
+     * arrays that is the prefix length.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two array lengths.
+     * (See {@link #mismatch(float[], float[])} for the definition of a common
+     * and proper prefix.)
+     *
+     * <p>A {@code null} array reference is considered lexicographically less
+     * than a non-{@code null} array reference.  Two {@code null} array
+     * references are considered equal.
+     *
+     * <p>The comparison is consistent with {@link #equals(float[], float[]) equals},
+     * more specifically the following holds for arrays {@code a} and {@code b}:
+     * <pre>{@code
+     *     Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if (for non-{@code null} array references):
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, b);
+     *     if (i >= 0 && i < Math.min(a.length, b.length))
+     *         return Float.compare(a[i], b[i]);
+     *     return a.length - b.length;
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param b the second array to compare
+     * @return the value {@code 0} if the first and second array are equal and
+     *         contain the same elements in the same order;
+     *         a value less than {@code 0} if the first array is
+     *         lexicographically less than the second array; and
+     *         a value greater than {@code 0} if the first array is
+     *         lexicographically greater than the second array
+     * @since 9
+     */
+    public static int compare(float[] a, float[] b) {
+        if (a == b)
+            return 0;
+        if (a == null || b == null)
+            return a == null ? -1 : 1;
+
+        int length = Math.min(a.length, b.length);
+        for (int i = 0; i < length; i++) {
+            float va = a[i], vb = b[i];
+            if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb)) {
+                int c = Float.compare(va, vb);
+                if (c != 0) return c;
+            }
+        }
+
+        return a.length - b.length;
+    }
+
+    /**
+     * Compares two {@code float} arrays lexicographically over the specified
+     * ranges.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the lexicographic comparison is the result of comparing two
+     * elements, as if by {@link Float#compare(float, float)}, at a relative
+     * index within the respective arrays that is the length of the prefix.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two range lengths.
+     * (See {@link #mismatch(float[], int, int, float[], int, int)} for the
+     * definition of a common and proper prefix.)
+     *
+     * <p>The comparison is consistent with
+     * {@link #equals(float[], int, int, float[], int, int) equals}, more
+     * specifically the following holds for arrays {@code a} and {@code b} with
+     * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively:
+     * <pre>{@code
+     *     Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+     *         (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if:
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+     *                             b, bFromIndex, bToIndex);
+     *     if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     *         return Float.compare(a[aFromIndex + i], b[bFromIndex + i]);
+     *     return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be compared
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be compared
+     * @param b the second array to compare
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be compared
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be compared
+     * @return the value {@code 0} if, over the specified ranges, the first and
+     *         second array are equal and contain the same elements in the same
+     *         order;
+     *         a value less than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically less than the second array; and
+     *         a value greater than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically greater than the second array
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int compare(float[] a, int aFromIndex, int aToIndex,
+                              float[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            float va = a[aFromIndex++], vb = b[bFromIndex++];
+            if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb)) {
+                int c = Float.compare(va, vb);
+                if (c != 0) return c;
+            }
+        }
+
+        return aLength - bLength;
+    }
+
+    // Compare double
+
+    /**
+     * Compares two {@code double} arrays lexicographically.
+     *
+     * <p>If the two arrays share a common prefix then the lexicographic
+     * comparison is the result of comparing two elements, as if by
+     * {@link Double#compare(double, double)}, at an index within the respective
+     * arrays that is the prefix length.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two array lengths.
+     * (See {@link #mismatch(double[], double[])} for the definition of a common
+     * and proper prefix.)
+     *
+     * <p>A {@code null} array reference is considered lexicographically less
+     * than a non-{@code null} array reference.  Two {@code null} array
+     * references are considered equal.
+     *
+     * <p>The comparison is consistent with {@link #equals(double[], double[]) equals},
+     * more specifically the following holds for arrays {@code a} and {@code b}:
+     * <pre>{@code
+     *     Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if (for non-{@code null} array references):
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, b);
+     *     if (i >= 0 && i < Math.min(a.length, b.length))
+     *         return Double.compare(a[i], b[i]);
+     *     return a.length - b.length;
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param b the second array to compare
+     * @return the value {@code 0} if the first and second array are equal and
+     *         contain the same elements in the same order;
+     *         a value less than {@code 0} if the first array is
+     *         lexicographically less than the second array; and
+     *         a value greater than {@code 0} if the first array is
+     *         lexicographically greater than the second array
+     * @since 9
+     */
+    public static int compare(double[] a, double[] b) {
+        if (a == b)
+            return 0;
+        if (a == null || b == null)
+            return a == null ? -1 : 1;
+
+        int length = Math.min(a.length, b.length);
+        for (int i = 0; i < length; i++) {
+            double va = a[i], vb = b[i];
+            if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb)) {
+                int c = Double.compare(va, vb);
+                if (c != 0) return c;
+            }
+        }
+
+        return a.length - b.length;
+    }
+
+    /**
+     * Compares two {@code double} arrays lexicographically over the specified
+     * ranges.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the lexicographic comparison is the result of comparing two
+     * elements, as if by {@link Double#compare(double, double)}, at a relative
+     * index within the respective arrays that is the length of the prefix.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two range lengths.
+     * (See {@link #mismatch(double[], int, int, double[], int, int)} for the
+     * definition of a common and proper prefix.)
+     *
+     * <p>The comparison is consistent with
+     * {@link #equals(double[], int, int, double[], int, int) equals}, more
+     * specifically the following holds for arrays {@code a} and {@code b} with
+     * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively:
+     * <pre>{@code
+     *     Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+     *         (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if:
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+     *                             b, bFromIndex, bToIndex);
+     *     if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     *         return Double.compare(a[aFromIndex + i], b[bFromIndex + i]);
+     *     return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be compared
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be compared
+     * @param b the second array to compare
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be compared
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be compared
+     * @return the value {@code 0} if, over the specified ranges, the first and
+     *         second array are equal and contain the same elements in the same
+     *         order;
+     *         a value less than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically less than the second array; and
+     *         a value greater than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically greater than the second array
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int compare(double[] a, int aFromIndex, int aToIndex,
+                              double[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            double va = a[aFromIndex++], vb = b[bFromIndex++];
+            if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb)) {
+                int c = Double.compare(va, vb);
+                if (c != 0) return c;
+            }
+        }
+
+        return aLength - bLength;
+    }
+
+    // Compare objects
+
+    /**
+     * Compares two {@code Object} arrays, within comparable elements,
+     * lexicographically.
+     *
+     * <p>If the two arrays share a common prefix then the lexicographic
+     * comparison is the result of comparing two elements of type {@code T} at
+     * an index {@code i} within the respective arrays that is the prefix
+     * length, as if by:
+     * <pre>{@code
+     *     Comparator.nullsFirst(Comparator.<T>naturalOrder()).
+     *         compare(a[i], b[i])
+     * }</pre>
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two array lengths.
+     * (See {@link #mismatch(Object[], Object[])} for the definition of a common
+     * and proper prefix.)
+     *
+     * <p>A {@code null} array reference is considered lexicographically less
+     * than a non-{@code null} array reference.  Two {@code null} array
+     * references are considered equal.
+     * A {@code null} array element is considered lexicographically than a
+     * non-{@code null} array element.  Two {@code null} array elements are
+     * considered equal.
+     *
+     * <p>The comparison is consistent with {@link #equals(Object[], Object[]) equals},
+     * more specifically the following holds for arrays {@code a} and {@code b}:
+     * <pre>{@code
+     *     Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if (for non-{@code null} array references
+     * and elements):
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, b);
+     *     if (i >= 0 && i < Math.min(a.length, b.length))
+     *         return a[i].compareTo(b[i]);
+     *     return a.length - b.length;
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param b the second array to compare
+     * @param <T> the type of comparable array elements
+     * @return the value {@code 0} if the first and second array are equal and
+     *         contain the same elements in the same order;
+     *         a value less than {@code 0} if the first array is
+     *         lexicographically less than the second array; and
+     *         a value greater than {@code 0} if the first array is
+     *         lexicographically greater than the second array
+     * @since 9
+     */
+    public static <T extends Comparable<? super T>> int compare(T[] a, T[] b) {
+        if (a == b)
+            return 0;
+        // A null array is less than a non-null array
+        if (a == null || b == null)
+            return a == null ? -1 : 1;
+
+        int length = Math.min(a.length, b.length);
+        for (int i = 0; i < length; i++) {
+            T oa = a[i];
+            T ob = b[i];
+            if (oa != ob) {
+                // A null element is less than a non-null element
+                if (oa == null || ob == null)
+                    return oa == null ? -1 : 1;
+                int v = oa.compareTo(ob);
+                if (v != 0) {
+                    return v;
+                }
+            }
+        }
+
+        return a.length - b.length;
+    }
+
+    /**
+     * Compares two {@code Object} arrays lexicographically over the specified
+     * ranges.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the lexicographic comparison is the result of comparing two
+     * elements of type {@code T} at a relative index {@code i} within the
+     * respective arrays that is the prefix length, as if by:
+     * <pre>{@code
+     *     Comparator.nullsFirst(Comparator.<T>naturalOrder()).
+     *         compare(a[aFromIndex + i, b[bFromIndex + i])
+     * }</pre>
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two range lengths.
+     * (See {@link #mismatch(Object[], int, int, Object[], int, int)} for the
+     * definition of a common and proper prefix.)
+     *
+     * <p>The comparison is consistent with
+     * {@link #equals(Object[], int, int, Object[], int, int) equals}, more
+     * specifically the following holds for arrays {@code a} and {@code b} with
+     * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively:
+     * <pre>{@code
+     *     Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+     *         (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+     * }</pre>
+     *
+     * @apiNote
+     * <p>This method behaves as if (for non-{@code null} array elements):
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+     *                             b, bFromIndex, bToIndex);
+     *     if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     *         return a[aFromIndex + i].compareTo(b[bFromIndex + i]);
+     *     return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be compared
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be compared
+     * @param b the second array to compare
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be compared
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be compared
+     * @param <T> the type of comparable array elements
+     * @return the value {@code 0} if, over the specified ranges, the first and
+     *         second array are equal and contain the same elements in the same
+     *         order;
+     *         a value less than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically less than the second array; and
+     *         a value greater than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically greater than the second array
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static <T extends Comparable<? super T>> int compare(
+            T[] a, int aFromIndex, int aToIndex,
+            T[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            T oa = a[aFromIndex++];
+            T ob = b[bFromIndex++];
+            if (oa != ob) {
+                if (oa == null || ob == null)
+                    return oa == null ? -1 : 1;
+                int v = oa.compareTo(ob);
+                if (v != 0) {
+                    return v;
+                }
+            }
+        }
+
+        return aLength - bLength;
+    }
+
+    /**
+     * Compares two {@code Object} arrays lexicographically using a specified
+     * comparator.
+     *
+     * <p>If the two arrays share a common prefix then the lexicographic
+     * comparison is the result of comparing with the specified comparator two
+     * elements at an index within the respective arrays that is the prefix
+     * length.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two array lengths.
+     * (See {@link #mismatch(Object[], Object[])} for the definition of a common
+     * and proper prefix.)
+     *
+     * <p>A {@code null} array reference is considered lexicographically less
+     * than a non-{@code null} array reference.  Two {@code null} array
+     * references are considered equal.
+     *
+     * @apiNote
+     * <p>This method behaves as if (for non-{@code null} array references):
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, b, cmp);
+     *     if (i >= 0 && i < Math.min(a.length, b.length))
+     *         return cmp.compare(a[i], b[i]);
+     *     return a.length - b.length;
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param b the second array to compare
+     * @param cmp the comparator to compare array elements
+     * @param <T> the type of array elements
+     * @return the value {@code 0} if the first and second array are equal and
+     *         contain the same elements in the same order;
+     *         a value less than {@code 0} if the first array is
+     *         lexicographically less than the second array; and
+     *         a value greater than {@code 0} if the first array is
+     *         lexicographically greater than the second array
+     * @throws NullPointerException if the comparator is {@code null}
+     * @since 9
+     */
+    public static <T> int compare(T[] a, T[] b,
+                                  Comparator<? super T> cmp) {
+        Objects.requireNonNull(cmp);
+        if (a == b)
+            return 0;
+        if (a == null || b == null)
+            return a == null ? -1 : 1;
+
+        int length = Math.min(a.length, b.length);
+        for (int i = 0; i < length; i++) {
+            T oa = a[i];
+            T ob = b[i];
+            if (oa != ob) {
+                // Null-value comparison is deferred to the comparator
+                int v = cmp.compare(oa, ob);
+                if (v != 0) {
+                    return v;
+                }
+            }
+        }
+
+        return a.length - b.length;
+    }
+
+    /**
+     * Compares two {@code Object} arrays lexicographically over the specified
+     * ranges.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the lexicographic comparison is the result of comparing with the
+     * specified comparator two elements at a relative index within the
+     * respective arrays that is the prefix length.
+     * Otherwise, one array is a proper prefix of the other and, lexicographic
+     * comparison is the result of comparing the two range lengths.
+     * (See {@link #mismatch(Object[], int, int, Object[], int, int)} for the
+     * definition of a common and proper prefix.)
+     *
+     * @apiNote
+     * <p>This method behaves as if (for non-{@code null} array elements):
+     * <pre>{@code
+     *     int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+     *                             b, bFromIndex, bToIndex, cmp);
+     *     if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     *         return cmp.compare(a[aFromIndex + i], b[bFromIndex + i]);
+     *     return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+     * }</pre>
+     *
+     * @param a the first array to compare
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be compared
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be compared
+     * @param b the second array to compare
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be compared
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be compared
+     * @param cmp the comparator to compare array elements
+     * @param <T> the type of array elements
+     * @return the value {@code 0} if, over the specified ranges, the first and
+     *         second array are equal and contain the same elements in the same
+     *         order;
+     *         a value less than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically less than the second array; and
+     *         a value greater than {@code 0} if, over the specified ranges, the
+     *         first array is lexicographically greater than the second array
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array or the comparator is {@code null}
+     * @since 9
+     */
+    public static <T> int compare(
+            T[] a, int aFromIndex, int aToIndex,
+            T[] b, int bFromIndex, int bToIndex,
+            Comparator<? super T> cmp) {
+        Objects.requireNonNull(cmp);
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            T oa = a[aFromIndex++];
+            T ob = b[bFromIndex++];
+            if (oa != ob) {
+                // Null-value comparison is deferred to the comparator
+                int v = cmp.compare(oa, ob);
+                if (v != 0) {
+                    return v;
+                }
+            }
+        }
+
+        return aLength - bLength;
+    }
+
+
+    // Mismatch methods
+
+    // Mismatch boolean
+
+    /**
+     * Finds and returns the index of the first mismatch between two
+     * {@code boolean} arrays, 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 array.
+     *
+     * <p>If the two arrays share a common prefix then the returned index is the
+     * length of the common prefix and it follows that there is a mismatch
+     * between the two elements at that index within the respective arrays.
+     * If one array is a proper prefix of the other then the returned index is
+     * the length of the smaller array and it follows that the index is only
+     * valid for the larger array.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(a.length, b.length) &&
+     *     Arrays.equals(a, 0, pl, b, 0, pl) &&
+     *     a[pl] != b[pl]
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+     * prefix if the following expression is true:
+     * <pre>{@code
+     *     a.length != b.length &&
+     *     Arrays.equals(a, 0, Math.min(a.length, b.length),
+     *                   b, 0, Math.min(a.length, b.length))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param b the second array to be tested for a mismatch
+     * @return the index of the first mismatch between the two arrays,
+     *         otherwise {@code -1}.
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(boolean[] a, boolean[] b) {
+        int length = Math.min(a.length, b.length); // Check null array refs
+        if (a == b)
+            return -1;
+
+        for (int i = 0; i < length; i++) {
+            if (a[i] != b[i]) return i;
+        }
+
+        return a.length != b.length ? length : -1;
+    }
+
+    /**
+     * Finds and returns the relative index of the first mismatch between two
+     * {@code boolean} 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.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the returned relative index is the length of the common prefix and
+     * it follows that there is a mismatch between the two elements at that
+     * relative index within the respective arrays.
+     * If one array is a proper prefix of the other, over the specified ranges,
+     * then the returned relative index is the length of the smaller range and
+     * it follows that the relative index is only valid for the array with the
+     * larger range.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+     *     a[aFromIndex + pl] != b[bFromIndex + pl]
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+     * if the following expression is true:
+     * <pre>{@code
+     *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+     *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested for a mismatch
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return the relative index of the first mismatch between the two arrays
+     *         over the specified ranges, otherwise {@code -1}.
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(boolean[] a, int aFromIndex, int aToIndex,
+                               boolean[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            if (a[aFromIndex++] != b[bFromIndex++]) return i;
+        }
+
+        return aLength != bLength ? length : -1;
+    }
+
+    // Mismatch byte
+
+    /**
+     * Finds and returns the index of the first mismatch between two {@code byte}
+     * arrays, 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
+     * array.
+     *
+     * <p>If the two arrays share a common prefix then the returned index is the
+     * length of the common prefix and it follows that there is a mismatch
+     * between the two elements at that index within the respective arrays.
+     * If one array is a proper prefix of the other then the returned index is
+     * the length of the smaller array and it follows that the index is only
+     * valid for the larger array.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(a.length, b.length) &&
+     *     Arrays.equals(a, 0, pl, b, 0, pl) &&
+     *     a[pl] != b[pl]
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+     * prefix if the following expression is true:
+     * <pre>{@code
+     *     a.length != b.length &&
+     *     Arrays.equals(a, 0, Math.min(a.length, b.length),
+     *                   b, 0, Math.min(a.length, b.length))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param b the second array to be tested for a mismatch
+     * @return the index of the first mismatch between the two arrays,
+     *         otherwise {@code -1}.
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(byte[] a, byte[] b) {
+        int length = Math.min(a.length, b.length); // Check null array refs
+        if (a == b)
+            return -1;
+
+        for (int i = 0; i < length; i++) {
+            if (a[i] != b[i]) return i;
+        }
+
+        return a.length != b.length ? length : -1;
+    }
+
+    /**
+     * Finds and returns the relative index of the first mismatch between two
+     * {@code 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.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the returned relative index is the length of the common prefix and
+     * it follows that there is a mismatch between the two elements at that
+     * relative index within the respective arrays.
+     * If one array is a proper prefix of the other, over the specified ranges,
+     * then the returned relative index is the length of the smaller range and
+     * it follows that the relative index is only valid for the array with the
+     * larger range.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+     *     a[aFromIndex + pl] != b[bFromIndex + pl]
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+     * if the following expression is true:
+     * <pre>{@code
+     *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+     *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested for a mismatch
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return the relative index of the first mismatch between the two arrays
+     *         over the specified ranges, otherwise {@code -1}.
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(byte[] a, int aFromIndex, int aToIndex,
+                               byte[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            if (a[aFromIndex++] != b[bFromIndex++]) return i;
+        }
+
+        return aLength != bLength ? length : -1;
+    }
+
+    // Mismatch char
+
+    /**
+     * Finds and returns the index of the first mismatch between two {@code char}
+     * arrays, 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
+     * array.
+     *
+     * <p>If the two arrays share a common prefix then the returned index is the
+     * length of the common prefix and it follows that there is a mismatch
+     * between the two elements at that index within the respective arrays.
+     * If one array is a proper prefix of the other then the returned index is
+     * the length of the smaller array and it follows that the index is only
+     * valid for the larger array.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(a.length, b.length) &&
+     *     Arrays.equals(a, 0, pl, b, 0, pl) &&
+     *     a[pl] != b[pl]
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+     * prefix if the following expression is true:
+     * <pre>{@code
+     *     a.length != b.length &&
+     *     Arrays.equals(a, 0, Math.min(a.length, b.length),
+     *                   b, 0, Math.min(a.length, b.length))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param b the second array to be tested for a mismatch
+     * @return the index of the first mismatch between the two arrays,
+     *         otherwise {@code -1}.
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(char[] a, char[] b) {
+        int length = Math.min(a.length, b.length); // Check null array refs
+        if (a == b)
+            return -1;
+
+        for (int i = 0; i < length; i++) {
+            if (a[i] != b[i]) return i;
+        }
+
+        return a.length != b.length ? length : -1;
+    }
+
+    /**
+     * Finds and returns the relative index of the first mismatch between two
+     * {@code char} 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.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the returned relative index is the length of the common prefix and
+     * it follows that there is a mismatch between the two elements at that
+     * relative index within the respective arrays.
+     * If one array is a proper prefix of the other, over the specified ranges,
+     * then the returned relative index is the length of the smaller range and
+     * it follows that the relative index is only valid for the array with the
+     * larger range.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+     *     a[aFromIndex + pl] != b[bFromIndex + pl]
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+     * if the following expression is true:
+     * <pre>{@code
+     *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+     *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested for a mismatch
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return the relative index of the first mismatch between the two arrays
+     *         over the specified ranges, otherwise {@code -1}.
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(char[] a, int aFromIndex, int aToIndex,
+                               char[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            if (a[aFromIndex++] != b[bFromIndex++]) return i;
+        }
+
+        return aLength != bLength ? length : -1;
+    }
+
+    // Mismatch short
+
+    /**
+     * Finds and returns the index of the first mismatch between two {@code short}
+     * arrays, 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
+     * array.
+     *
+     * <p>If the two arrays share a common prefix then the returned index is the
+     * length of the common prefix and it follows that there is a mismatch
+     * between the two elements at that index within the respective arrays.
+     * If one array is a proper prefix of the other then the returned index is
+     * the length of the smaller array and it follows that the index is only
+     * valid for the larger array.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(a.length, b.length) &&
+     *     Arrays.equals(a, 0, pl, b, 0, pl) &&
+     *     a[pl] != b[pl]
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+     * prefix if the following expression is true:
+     * <pre>{@code
+     *     a.length != b.length &&
+     *     Arrays.equals(a, 0, Math.min(a.length, b.length),
+     *                   b, 0, Math.min(a.length, b.length))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param b the second array to be tested for a mismatch
+     * @return the index of the first mismatch between the two arrays,
+     *         otherwise {@code -1}.
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(short[] a, short[] b) {
+        int length = Math.min(a.length, b.length); // Check null array refs
+        if (a == b)
+            return -1;
+
+        for (int i = 0; i < length; i++) {
+            if (a[i] != b[i]) return i;
+        }
+
+        return a.length != b.length ? length : -1;
+    }
+
+    /**
+     * Finds and returns the relative index of the first mismatch between two
+     * {@code short} 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.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the returned relative index is the length of the common prefix and
+     * it follows that there is a mismatch between the two elements at that
+     * relative index within the respective arrays.
+     * If one array is a proper prefix of the other, over the specified ranges,
+     * then the returned relative index is the length of the smaller range and
+     * it follows that the relative index is only valid for the array with the
+     * larger range.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+     *     a[aFromIndex + pl] != b[bFromIndex + pl]
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+     * if the following expression is true:
+     * <pre>{@code
+     *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+     *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested for a mismatch
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return the relative index of the first mismatch between the two arrays
+     *         over the specified ranges, otherwise {@code -1}.
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(short[] a, int aFromIndex, int aToIndex,
+                               short[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            if (a[aFromIndex++] != b[bFromIndex++]) return i;
+        }
+
+        return aLength != bLength ? length : -1;
+    }
+
+    // Mismatch int
+
+    /**
+     * Finds and returns the index of the first mismatch between two {@code int}
+     * arrays, 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
+     * array.
+     *
+     * <p>If the two arrays share a common prefix then the returned index is the
+     * length of the common prefix and it follows that there is a mismatch
+     * between the two elements at that index within the respective arrays.
+     * If one array is a proper prefix of the other then the returned index is
+     * the length of the smaller array and it follows that the index is only
+     * valid for the larger array.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(a.length, b.length) &&
+     *     Arrays.equals(a, 0, pl, b, 0, pl) &&
+     *     a[pl] != b[pl]
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+     * prefix if the following expression is true:
+     * <pre>{@code
+     *     a.length != b.length &&
+     *     Arrays.equals(a, 0, Math.min(a.length, b.length),
+     *                   b, 0, Math.min(a.length, b.length))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param b the second array to be tested for a mismatch
+     * @return the index of the first mismatch between the two arrays,
+     *         otherwise {@code -1}.
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(int[] a, int[] b) {
+        int length = Math.min(a.length, b.length); // Check null array refs
+        if (a == b)
+            return -1;
+
+        for (int i = 0; i < length; i++) {
+            if (a[i] != b[i]) return i;
+        }
+
+        return a.length != b.length ? length : -1;
+    }
+
+    /**
+     * Finds and returns the relative index of the first mismatch between two
+     * {@code int} 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.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the returned relative index is the length of the common prefix and
+     * it follows that there is a mismatch between the two elements at that
+     * relative index within the respective arrays.
+     * If one array is a proper prefix of the other, over the specified ranges,
+     * then the returned relative index is the length of the smaller range and
+     * it follows that the relative index is only valid for the array with the
+     * larger range.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+     *     a[aFromIndex + pl] != b[bFromIndex + pl]
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+     * if the following expression is true:
+     * <pre>{@code
+     *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+     *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested for a mismatch
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return the relative index of the first mismatch between the two arrays
+     *         over the specified ranges, otherwise {@code -1}.
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(int[] a, int aFromIndex, int aToIndex,
+                               int[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            if (a[aFromIndex++] != b[bFromIndex++]) return i;
+        }
+
+        return aLength != bLength ? length : -1;
+    }
+
+    // Mismatch long
+
+    /**
+     * Finds and returns the index of the first mismatch between two {@code long}
+     * arrays, 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
+     * array.
+     *
+     * <p>If the two arrays share a common prefix then the returned index is the
+     * length of the common prefix and it follows that there is a mismatch
+     * between the two elements at that index within the respective arrays.
+     * If one array is a proper prefix of the other then the returned index is
+     * the length of the smaller array and it follows that the index is only
+     * valid for the larger array.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(a.length, b.length) &&
+     *     Arrays.equals(a, 0, pl, b, 0, pl) &&
+     *     a[pl] != b[pl]
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+     * prefix if the following expression is true:
+     * <pre>{@code
+     *     a.length != b.length &&
+     *     Arrays.equals(a, 0, Math.min(a.length, b.length),
+     *                   b, 0, Math.min(a.length, b.length))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param b the second array to be tested for a mismatch
+     * @return the index of the first mismatch between the two arrays,
+     *         otherwise {@code -1}.
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(long[] a, long[] b) {
+        int length = Math.min(a.length, b.length); // Check null array refs
+        if (a == b)
+            return -1;
+
+        for (int i = 0; i < length; i++) {
+            if (a[i] != b[i]) return i;
+        }
+
+        return a.length != b.length ? length : -1;
+    }
+
+    /**
+     * Finds and returns the relative index of the first mismatch between two
+     * {@code long} 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.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the returned relative index is the length of the common prefix and
+     * it follows that there is a mismatch between the two elements at that
+     * relative index within the respective arrays.
+     * If one array is a proper prefix of the other, over the specified ranges,
+     * then the returned relative index is the length of the smaller range and
+     * it follows that the relative index is only valid for the array with the
+     * larger range.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+     *     a[aFromIndex + pl] != b[bFromIndex + pl]
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+     * if the following expression is true:
+     * <pre>{@code
+     *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+     *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested for a mismatch
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return the relative index of the first mismatch between the two arrays
+     *         over the specified ranges, otherwise {@code -1}.
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(long[] a, int aFromIndex, int aToIndex,
+                               long[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            if (a[aFromIndex++] != b[bFromIndex++]) return i;
+        }
+
+        return aLength != bLength ? length : -1;
+    }
+
+    // Mismatch float
+
+    /**
+     * Finds and returns the index of the first mismatch between two {@code float}
+     * arrays, 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
+     * array.
+     *
+     * <p>If the two arrays share a common prefix then the returned index is the
+     * length of the common prefix and it follows that there is a mismatch
+     * between the two elements at that index within the respective arrays.
+     * If one array is a proper prefix of the other then the returned index is
+     * the length of the smaller array and it follows that the index is only
+     * valid for the larger array.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(a.length, b.length) &&
+     *     Arrays.equals(a, 0, pl, b, 0, pl) &&
+     *     Float.compare(a[pl], b[pl]) != 0
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+     * prefix if the following expression is true:
+     * <pre>{@code
+     *     a.length != b.length &&
+     *     Arrays.equals(a, 0, Math.min(a.length, b.length),
+     *                   b, 0, Math.min(a.length, b.length))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param b the second array to be tested for a mismatch
+     * @return the index of the first mismatch between the two arrays,
+     *         otherwise {@code -1}.
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(float[] a, float[] b) {
+        int length = Math.min(a.length, b.length); // Check null array refs
+        if (a == b)
+            return -1;
+
+        for (int i = 0; i < length; i++) {
+            float va = a[i], vb = b[i];
+            if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb))
+                if (!Float.isNaN(va) || !Float.isNaN(vb))
+                    return i;
+        }
+
+        return a.length != b.length ? length : -1;
+    }
+
+    /**
+     * Finds and returns the relative index of the first mismatch between two
+     * {@code float} 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.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the returned relative index is the length of the common prefix and
+     * it follows that there is a mismatch between the two elements at that
+     * relative index within the respective arrays.
+     * If one array is a proper prefix of the other, over the specified ranges,
+     * then the returned relative index is the length of the smaller range and
+     * it follows that the relative index is only valid for the array with the
+     * larger range.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+     *     Float.compare(a[aFromIndex + pl], b[bFromIndex + pl]) != 0
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+     * if the following expression is true:
+     * <pre>{@code
+     *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+     *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested for a mismatch
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return the relative index of the first mismatch between the two arrays
+     *         over the specified ranges, otherwise {@code -1}.
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(float[] a, int aFromIndex, int aToIndex,
+                               float[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            float va = a[aFromIndex++], vb = b[bFromIndex++];
+            if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb))
+                if (!Float.isNaN(va) || !Float.isNaN(vb))
+                    return i;
+        }
+
+        return aLength != bLength ? length : -1;
+    }
+
+    // Mismatch double
+
+    /**
+     * Finds and returns the index of the first mismatch between two
+     * {@code double} arrays, 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 array.
+     *
+     * <p>If the two arrays share a common prefix then the returned index is the
+     * length of the common prefix and it follows that there is a mismatch
+     * between the two elements at that index within the respective arrays.
+     * If one array is a proper prefix of the other then the returned index is
+     * the length of the smaller array and it follows that the index is only
+     * valid for the larger array.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(a.length, b.length) &&
+     *     Arrays.equals(a, 0, pl, b, 0, pl) &&
+     *     Double.compare(a[pl], b[pl]) != 0
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+     * prefix if the following expression is true:
+     * <pre>{@code
+     *     a.length != b.length &&
+     *     Arrays.equals(a, 0, Math.min(a.length, b.length),
+     *                   b, 0, Math.min(a.length, b.length))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param b the second array to be tested for a mismatch
+     * @return the index of the first mismatch between the two arrays,
+     *         otherwise {@code -1}.
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(double[] a, double[] b) {
+        int length = Math.min(a.length, b.length); // Check null array refs
+        if (a == b)
+            return -1;
+
+        for (int i = 0; i < length; i++) {
+            double va = a[i], vb = b[i];
+            if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb))
+                if (!Double.isNaN(va) || !Double.isNaN(vb))
+                    return i;
+        }
+
+        return a.length != b.length ? length : -1;
+    }
+
+    /**
+     * Finds and returns the relative index of the first mismatch between two
+     * {@code double} 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.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the returned relative index is the length of the common prefix and
+     * it follows that there is a mismatch between the two elements at that
+     * relative index within the respective arrays.
+     * If one array is a proper prefix of the other, over the specified ranges,
+     * then the returned relative index is the length of the smaller range and
+     * it follows that the relative index is only valid for the array with the
+     * larger range.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+     *     Double.compare(a[aFromIndex + pl], b[bFromIndex + pl]) != 0
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+     * if the following expression is true:
+     * <pre>{@code
+     *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+     *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested for a mismatch
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return the relative index of the first mismatch between the two arrays
+     *         over the specified ranges, otherwise {@code -1}.
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(double[] a, int aFromIndex, int aToIndex,
+                               double[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            double va = a[aFromIndex++], vb = b[bFromIndex++];
+            if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb))
+                if (!Double.isNaN(va) || !Double.isNaN(vb))
+                    return i;
+        }
+
+        return aLength != bLength ? length : -1;
+    }
+
+    // Mismatch objects
+
+    /**
+     * Finds and returns the index of the first mismatch between two
+     * {@code Object} arrays, 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 array.
+     *
+     * <p>If the two arrays share a common prefix then the returned index is the
+     * length of the common prefix and it follows that there is a mismatch
+     * between the two elements at that index within the respective arrays.
+     * If one array is a proper prefix of the other then the returned index is
+     * the length of the smaller array and it follows that the index is only
+     * valid for the larger array.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(a.length, b.length) &&
+     *     Arrays.equals(a, 0, pl, b, 0, pl) &&
+     *     !Objects.equals(a[pl], b[pl])
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+     * prefix if the following expression is true:
+     * <pre>{@code
+     *     a.length != b.length &&
+     *     Arrays.equals(a, 0, Math.min(a.length, b.length),
+     *                   b, 0, Math.min(a.length, b.length))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param b the second array to be tested for a mismatch
+     * @return the index of the first mismatch between the two arrays,
+     *         otherwise {@code -1}.
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(Object[] a, Object[] b) {
+        int length = Math.min(a.length, b.length); // Check null array refs
+        if (a == b)
+            return -1;
+
+        for (int i = 0; i < length; i++) {
+            if (!Objects.equals(a[i], b[i]))
+                return i;
+        }
+
+        return a.length != b.length ? length : -1;
+    }
+
+    /**
+     * Finds and returns the relative index of the first mismatch between two
+     * {@code Object} 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.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the returned relative index is the length of the common prefix and
+     * it follows that there is a mismatch between the two elements at that
+     * relative index within the respective arrays.
+     * If one array is a proper prefix of the other, over the specified ranges,
+     * then the returned relative index is the length of the smaller range and
+     * it follows that the relative index is only valid for the array with the
+     * larger range.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+     *     !Objects.equals(a[aFromIndex + pl], b[bFromIndex + pl])
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+     * if the following expression is true:
+     * <pre>{@code
+     *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+     *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+     *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested for a mismatch
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @return the relative index of the first mismatch between the two arrays
+     *         over the specified ranges, otherwise {@code -1}.
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array is {@code null}
+     * @since 9
+     */
+    public static int mismatch(
+            Object[] a, int aFromIndex, int aToIndex,
+            Object[] b, int bFromIndex, int bToIndex) {
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            if (!Objects.equals(a[aFromIndex++], b[bFromIndex++]))
+                return i;
+        }
+
+        return aLength != bLength ? length : -1;
+    }
+
+    /**
+     * Finds and returns the index of the first mismatch between two
+     * {@code Object} arrays, 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 array.
+     *
+     * <p>The specified comparator is used to determine if two array elements
+     * from the each array are not equal.
+     *
+     * <p>If the two arrays share a common prefix then the returned index is the
+     * length of the common prefix and it follows that there is a mismatch
+     * between the two elements at that index within the respective arrays.
+     * If one array is a proper prefix of the other then the returned index is
+     * the length of the smaller array and it follows that the index is only
+     * valid for the larger array.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(a.length, b.length) &&
+     *     IntStream.range(0, pl).
+     *         map(i -> cmp.compare(a[i], b[i])).
+     *         allMatch(c -> c == 0) &&
+     *     cmp.compare(a[pl], b[pl]) != 0
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+     * prefix if the following expression is true:
+     * <pre>{@code
+     *     a.length != b.length &&
+     *     IntStream.range(0, Math.min(a.length, b.length)).
+     *         map(i -> cmp.compare(a[i], b[i])).
+     *         allMatch(c -> c == 0) &&
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param b the second array to be tested for a mismatch
+     * @param cmp the comparator to compare array elements
+     * @param <T> the type of array elements
+     * @return the index of the first mismatch between the two arrays,
+     *         otherwise {@code -1}.
+     * @throws NullPointerException
+     *         if either array or the comparator is {@code null}
+     * @since 9
+     */
+    public static <T> int mismatch(T[] a, T[] b, Comparator<? super T> cmp) {
+        Objects.requireNonNull(cmp);
+        int length = Math.min(a.length, b.length); // Check null array refs
+        if (a == b)
+            return -1;
+
+        for (int i = 0; i < length; i++) {
+            T oa = a[i];
+            T ob = b[i];
+            if (oa != ob) {
+                // Null-value comparison is deferred to the comparator
+                int v = cmp.compare(oa, ob);
+                if (v != 0) {
+                    return i;
+                }
+            }
+        }
+
+        return a.length != b.length ? length : -1;
+    }
+
+    /**
+     * Finds and returns the relative index of the first mismatch between two
+     * {@code Object} 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.
+     *
+     * <p>If the two arrays, over the specified ranges, share a common prefix
+     * then the returned relative index is the length of the common prefix and
+     * it follows that there is a mismatch between the two elements at that
+     * relative index within the respective arrays.
+     * If one array is a proper prefix of the other, over the specified ranges,
+     * then the returned relative index is the length of the smaller range and
+     * it follows that the relative index is only valid for the array with the
+     * larger range.
+     * Otherwise, there is no mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+     * prefix of length {@code pl} if the following expression is true:
+     * <pre>{@code
+     *     pl >= 0 &&
+     *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+     *     IntStream.range(0, pl).
+     *         map(i -> cmp.compare(a[aFromIndex + i], b[bFromIndex + i])).
+     *         allMatch(c -> c == 0) &&
+     *     cmp.compare(a[aFromIndex + pl], b[bFromIndex + pl]) != 0
+     * }</pre>
+     * Note that a common prefix length of {@code 0} indicates that the first
+     * elements from each array mismatch.
+     *
+     * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
+     * ranges [{@code aFromIndex}, {@code atoIndex}) and
+     * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+     * if the following expression is true:
+     * <pre>{@code
+     *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+     *     IntStream.range(0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex)).
+     *         map(i -> cmp.compare(a[aFromIndex + i], b[bFromIndex + i])).
+     *         allMatch(c -> c == 0)
+     * }</pre>
+     *
+     * @param a the first array to be tested for a mismatch
+     * @param aFromIndex the index (inclusive) of the first element in the
+     *                   first array to be tested
+     * @param aToIndex the index (exclusive) of the last element in the
+     *                 first array to be tested
+     * @param b the second array to be tested for a mismatch
+     * @param bFromIndex the index (inclusive) of the first element in the
+     *                   second array to be tested
+     * @param bToIndex the index (exclusive) of the last element in the
+     *                 second array to be tested
+     * @param cmp the comparator to compare array elements
+     * @param <T> the type of array elements
+     * @return the relative index of the first mismatch between the two arrays
+     *         over the specified ranges, otherwise {@code -1}.
+     * @throws IllegalArgumentException
+     *         if {@code aFromIndex > aToIndex} or
+     *         if {@code bFromIndex > bToIndex}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code aFromIndex < 0 or aToIndex > a.length} or
+     *         if {@code bFromIndex < 0 or bToIndex > b.length}
+     * @throws NullPointerException
+     *         if either array or the comparator is {@code null}
+     * @since 9
+     */
+    public static <T> int mismatch(
+            T[] a, int aFromIndex, int aToIndex,
+            T[] b, int bFromIndex, int bToIndex,
+            Comparator<? super T> cmp) {
+        Objects.requireNonNull(cmp);
+        rangeCheck(a.length, aFromIndex, aToIndex);
+        rangeCheck(b.length, bFromIndex, bToIndex);
+
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        int length = Math.min(aLength, bLength);
+        for (int i = 0; i < length; i++) {
+            T oa = a[aFromIndex++];
+            T ob = b[bFromIndex++];
+            if (oa != ob) {
+                // Null-value comparison is deferred to the comparator
+                int v = cmp.compare(oa, ob);
+                if (v != 0) {
+                    return i;
+                }
+            }
+        }
+
+        return aLength != bLength ? length : -1;
+    }
+}
\ No newline at end of file
--- a/src/java.base/share/classes/java/util/Collections.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/src/java.base/share/classes/java/util/Collections.java	Mon Nov 09 09:05:20 2015 -0800
@@ -2090,7 +2090,8 @@
      * through the returned set.<p>
      *
      * It is imperative that the user manually synchronize on the returned
-     * set when iterating over it:
+     * collection when traversing it via {@link Iterator}, {@link Spliterator}
+     * or {@link Stream}:
      * <pre>
      *  Set s = Collections.synchronizedSet(new HashSet());
      *      ...
@@ -2149,8 +2150,9 @@
      * through the returned sorted set (or its views).<p>
      *
      * It is imperative that the user manually synchronize on the returned
-     * sorted set when iterating over it or any of its {@code subSet},
-     * {@code headSet}, or {@code tailSet} views.
+     * sorted set when traversing it or any of its {@code subSet},
+     * {@code headSet}, or {@code tailSet} views via {@link Iterator},
+     * {@link Spliterator} or {@link Stream}:
      * <pre>
      *  SortedSet s = Collections.synchronizedSortedSet(new TreeSet());
      *      ...
@@ -2240,8 +2242,9 @@
      * accomplished through the returned navigable set (or its views).<p>
      *
      * It is imperative that the user manually synchronize on the returned
-     * navigable set when iterating over it or any of its {@code subSet},
-     * {@code headSet}, or {@code tailSet} views.
+     * navigable set when traversing it, or any of its {@code subSet},
+     * {@code headSet}, or {@code tailSet} views, via {@link Iterator},
+     * {@link Spliterator} or {@link Stream}:
      * <pre>
      *  NavigableSet s = Collections.synchronizedNavigableSet(new TreeSet());
      *      ...
@@ -2355,7 +2358,8 @@
      * through the returned list.<p>
      *
      * It is imperative that the user manually synchronize on the returned
-     * list when iterating over it:
+     * list when traversing it via {@link Iterator}, {@link Spliterator}
+     * or {@link Stream}:
      * <pre>
      *  List list = Collections.synchronizedList(new ArrayList());
      *      ...
@@ -2523,7 +2527,8 @@
      * through the returned map.<p>
      *
      * It is imperative that the user manually synchronize on the returned
-     * map when iterating over any of its collection views:
+     * map when traversing any of its collection views via {@link Iterator},
+     * {@link Spliterator} or {@link Stream}:
      * <pre>
      *  Map m = Collections.synchronizedMap(new HashMap());
      *      ...
@@ -2700,9 +2705,10 @@
      * through the returned sorted map (or its views).<p>
      *
      * It is imperative that the user manually synchronize on the returned
-     * sorted map when iterating over any of its collection views, or the
+     * sorted map when traversing any of its collection views, or the
      * collections views of any of its {@code subMap}, {@code headMap} or
-     * {@code tailMap} views.
+     * {@code tailMap} views, via {@link Iterator}, {@link Spliterator} or
+     * {@link Stream}:
      * <pre>
      *  SortedMap m = Collections.synchronizedSortedMap(new TreeMap());
      *      ...
@@ -2797,9 +2803,10 @@
      * accomplished through the returned navigable map (or its views).<p>
      *
      * It is imperative that the user manually synchronize on the returned
-     * navigable map when iterating over any of its collection views, or the
+     * navigable map when traversing any of its collection views, or the
      * collections views of any of its {@code subMap}, {@code headMap} or
-     * {@code tailMap} views.
+     * {@code tailMap} views, via {@link Iterator}, {@link Spliterator} or
+     * {@link Stream}:
      * <pre>
      *  NavigableMap m = Collections.synchronizedNavigableMap(new TreeMap());
      *      ...
--- a/src/java.base/share/classes/sun/invoke/util/Wrapper.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/src/java.base/share/classes/sun/invoke/util/Wrapper.java	Mon Nov 09 09:05:20 2015 -0800
@@ -27,18 +27,19 @@
 
 public enum Wrapper {
     //        wrapperType    primitiveType  char            zero         emptyArray          format
-    BOOLEAN(  Boolean.class, boolean.class, 'Z',      (Boolean)false, new boolean[0], Format.unsigned( 1)),
+    BOOLEAN(  Boolean.class, boolean.class, 'Z',          Boolean.FALSE, new boolean[0], Format.unsigned( 1)),
     // These must be in the order defined for widening primitive conversions in JLS 5.1.2
-    BYTE   (     Byte.class,    byte.class, 'B',       (Byte)(byte)0, new    byte[0], Format.signed(   8)),
-    SHORT  (    Short.class,   short.class, 'S',     (Short)(short)0, new   short[0], Format.signed(  16)),
-    CHAR   (Character.class,    char.class, 'C',  (Character)(char)0, new    char[0], Format.unsigned(16)),
-    INT    (  Integer.class,     int.class, 'I', (Integer)/*(int)*/0, new     int[0], Format.signed(  32)),
-    LONG   (     Long.class,    long.class, 'J',       (Long)(long)0, new    long[0], Format.signed(  64)),
-    FLOAT  (    Float.class,   float.class, 'F',     (Float)(float)0, new   float[0], Format.floating(32)),
-    DOUBLE (   Double.class,  double.class, 'D',   (Double)(double)0, new  double[0], Format.floating(64)),
-    OBJECT (   Object.class,  Object.class, 'L',                null, new  Object[0], Format.other(    1)),
+    // Avoid boxing integral types here to defer initialization of internal caches
+    BYTE   (     Byte.class,    byte.class, 'B',      new Byte((byte)0), new    byte[0], Format.signed(   8)),
+    SHORT  (    Short.class,   short.class, 'S',    new Short((short)0), new   short[0], Format.signed(  16)),
+    CHAR   (Character.class,    char.class, 'C', new Character((char)0), new    char[0], Format.unsigned(16)),
+    INT    (  Integer.class,     int.class, 'I',         new Integer(0), new     int[0], Format.signed(  32)),
+    LONG   (     Long.class,    long.class, 'J',            new Long(0), new    long[0], Format.signed(  64)),
+    FLOAT  (    Float.class,   float.class, 'F',        (Float)(float)0, new   float[0], Format.floating(32)),
+    DOUBLE (   Double.class,  double.class, 'D',      (Double)(double)0, new  double[0], Format.floating(64)),
+    OBJECT (   Object.class,  Object.class, 'L',                   null, new  Object[0], Format.other(    1)),
     // VOID must be the last type, since it is "assignable" from any other type:
-    VOID   (     Void.class,    void.class, 'V',                null,           null, Format.other(    0)),
+    VOID   (     Void.class,    void.class, 'V',                   null,           null, Format.other(    0)),
     ;
 
     private final Class<?> wrapperType;
--- a/src/java.base/share/native/libjimage/imageFile.cpp	Fri Nov 06 19:13:16 2015 +0300
+++ b/src/java.base/share/native/libjimage/imageFile.cpp	Mon Nov 09 09:05:20 2015 -0800
@@ -118,7 +118,7 @@
     // Deflate the attribute stream into an array of attributes.
     u1 byte;
     // Repeat until end header is found.
-    while ((byte = *data)) {
+    while ((data != NULL) && (byte = *data)) {
         // Extract kind from header byte.
         u1 kind = attribute_kind(byte);
         assert(kind < ATTRIBUTE_COUNT && "invalid image location attribute");
@@ -191,7 +191,7 @@
 // Release module data resource.
 ImageModuleData::~ImageModuleData() {
     if (_data) {
-        delete _data;
+        delete[] _data;
     }
 }
 
@@ -274,7 +274,7 @@
 }
 
 ImageFileReaderTable::~ImageFileReaderTable() {
-    delete _table;
+    delete[] _table;
 }
 
 // Add a new image entry to the table.
@@ -414,7 +414,7 @@
     close();
     // Free up name.
     if (_name) {
-        delete _name;
+        delete[] _name;
         _name = NULL;
     }
 }
@@ -668,7 +668,7 @@
                         &strings);
         // If not memory mapped then release temporary buffer.
         if (!MemoryMapImage) {
-                delete compressed_data;
+                delete[] compressed_data;
         }
     } else {
         // Read bytes from offset beyond the image index.
--- a/src/java.sql/share/classes/java/sql/Connection.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/src/java.sql/share/classes/java/sql/Connection.java	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1482,4 +1482,109 @@
      * @since 1.7
      */
     int getNetworkTimeout() throws SQLException;
+
+    // JDBC 4.3
+
+     /**
+     * Hints to the driver that a request, an independent unit of work, is beginning
+     * on this connection. Each request is independent of all other requests
+     * with regard to state local to the connection either on the client or the
+     * server. Work done between {@code beginRequest}, {@code endRequest}
+     * pairs does not depend on any other work done on the connection either as
+     * part of another request or outside of any request. A request may include multiple
+     * transactions. There may be dependencies on committed database state as
+     * that is not local to the connection.
+     * <p>
+     * Local state is defined as any state associated with a Connection that is
+     * local to the current Connection either in the client or the database that
+     * is not transparently reproducible.
+     * <p>
+     * Calls to {@code beginRequest} and {@code endRequest}  are not nested.
+     * Multiple calls to {@code beginRequest} without an intervening call
+     * to {@code endRequest} is not an error. The first {@code beginRequest} call
+     * marks the start of the request and subsequent calls are treated as
+     * a no-op
+     * <p>
+     * Use of {@code beginRequest} and {@code endRequest} is optional, vendor
+     * specific and should largely be transparent. In particular
+     * implementations may detect conditions that indicate dependence on
+     * other work such as an open transaction. It is recommended though not
+     * required that implementations throw a {@code SQLException} if there is an active
+     * transaction and {@code beginRequest} is called.
+     * Using these methods may improve performance or provide other benefits.
+     * Consult your vendors documentation for additional information.
+     * <p>
+     * It is recommended to
+     * enclose each unit of work in {@code beginRequest}, {@code endRequest}
+     * pairs such that there is no open transaction at the beginning or end of
+     * the request and no dependency on local state that crosses request
+     * boundaries. Committed database state is not local.
+     *
+     * @implSpec
+     * The default implementation is a no-op.
+     * <p>
+     * @apiNote
+     * This method is to be used by Connection pooling managers.
+     * <p>
+     * The pooling manager should call {@code beginRequest} on the underlying connection
+     * prior to returning a connection to the caller.
+     * <p>
+     * The pooling manager does not need to call {@code beginRequest} if:
+     * <ul>
+     * <li>The connection pool caches {@code PooledConnection} objects</li>
+     * <li>Returns a logical connection handle when {@code getConnection} is
+     * called by the application</li>
+     * <li>The pool manager calls {@code Connection.close} on the logical connection handle
+     * prior to returning the {@code PooledConnection} back to the cache</li>
+     * </ul>
+     * @throws SQLException if an error occurs
+     * @since 1.9
+     * @see endRequest
+     * @see javax.sql.PooledConnection
+     */
+    default void beginRequest() throws SQLException {
+       // Default method takes no action
+    }
+
+    /**
+     * Hints to the driver that a request, an independent unit of work,
+     * has completed. Calls to {@code beginRequest}
+     * and {@code endRequest} are not nested. Multiple
+     * calls to {@code endRequest} without an intervening call to {@code beginRequest}
+     * is not an error. The first {@code endRequest} call
+     * marks the request completed and subsequent calls are treated as
+     * a no-op. If {@code endRequest} is called without an initial call to
+     * {@code beginRequest} is a no-op.
+     *<p>
+     * The exact behavior of this method is vendor specific. In particular
+     * implementations may detect conditions that indicate dependence on
+     * other work such as an open transaction. It is recommended though not
+     * required that implementations throw a {@code SQLException} if there is an active
+     * transaction and {@code endRequest} is called.
+     *
+     * @implSpec
+     * The default implementation is a no-op.
+     * @apiNote
+     *
+     * This method is to be used by Connection pooling managers.
+     * <p>
+     * The pooling manager should call {@code endRequest} on the underlying connection
+     * when the applications returns the connection back to the connection pool.
+     * <p>
+     * The pooling manager does not need to call {@code endRequest} if:
+     * <ul>
+     * <li>The connection pool caches {@code PooledConnection} objects</li>
+     * <li>Returns a logical connection handle when {@code getConnection} is
+     * called by the application</li>
+     * <li>The pool manager calls {@code Connection.close} on the logical connection handle
+     * prior to returning the {@code PooledConnection} back to the cache</li>
+     * </ul>
+     * @throws SQLException if an error occurs
+     * @since 1.9
+     * @see beginRequest
+     * @see javax.sql.PooledConnection
+     */
+    default void endRequest() throws SQLException {
+            // Default method takes no action
+    }
 }
--- a/src/java.sql/share/classes/javax/sql/PooledConnection.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/src/java.sql/share/classes/javax/sql/PooledConnection.java	Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,7 +66,16 @@
  * <code>PooledConnection</code> object to the pool of connections so that
  * it can be used again.  Thus, when an application closes its connection,
  * the underlying physical connection is recycled rather than being closed.
- * <P>
+ * <p>
+ * If the connection pool manager wraps or provides a proxy to the logical
+ * handle returned from a call to {@code PoolConnection.getConnection}, the pool
+ * manager must do
+ * one of the following when the application calls {@code Connection.close}:
+ * <ul>
+ * <li>call {@code endRequest} on the logical {@code Connection} handle
+ * <li>call {@code close} on the logical {@code Connection} handle
+ * </ul>
+ * <p>
  * The physical connection is not closed until the connection pool manager
  * calls the <code>PooledConnection</code> method <code>close</code>.
  * This method is generally called to have an orderly shutdown of the server or
--- a/test/TEST.groups	Fri Nov 06 19:13:16 2015 +0300
+++ b/test/TEST.groups	Mon Nov 09 09:05:20 2015 -0800
@@ -27,6 +27,7 @@
 
 tier1 = \
     :jdk_lang \
+    -java/lang/ProcessHandle/TreeTest.java \
     :jdk_util \
     sun/nio/cs/ISO8859x.java \
     java/nio/Buffer \
@@ -34,6 +35,7 @@
     :jdk_math
 
 tier2 = \
+    java/lang/ProcessHandle/TreeTest.java \
     :jdk_io \
     :jdk_nio \
     -sun/nio/cs/ISO8859x.java \
--- a/test/java/lang/Class/IsEnum.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/test/java/lang/Class/IsEnum.java	Mon Nov 09 09:05:20 2015 -0800
@@ -32,8 +32,8 @@
 
 public class IsEnum {
 
-    static int test(Class clazz, boolean expected) {
-        int status = (clazz.isEnum() == expected)?0:1;
+    static int test(Class<?> clazz, boolean expected) {
+        int status = (clazz.isEnum() == expected) ? 0 : 1;
 
         if (status == 1) {
             System.err.println("Unexpected enum status for " + clazz);
@@ -41,23 +41,23 @@
         return status;
     }
 
-    public static void main(String argv[]) {
+    public static void main(String... argv) {
         int failures = 0;
 
         failures += test(IsEnum.class, false);
         failures += test(String.class, false);
         failures += test(Enum.class, false);
+        failures += test(EnumPoseur.class, false);
         failures += test(java.math.RoundingMode.class, true);
 
-        // Classes in java.lang.annoation
+        // Classes in java.lang.annotation
         failures += test(Annotation.class, false);
         failures += test(ElementType.class, true);
         failures += test(Retention.class, false);
         failures += test(RetentionPolicy.class, true);
         failures += test(Target.class, false);
-        failures += test(EnumPoseur.class, false);
 
-        // Classes for specialized enum constants aren't enum's
+        // A class for a specialized enum constant isn't itself an enum
         failures += test(SpecialEnum.class, true);
         failures += test(SpecialEnum.RED.getClass(), false);
         failures += test(SpecialEnum.GREEN.getClass(), true);
--- a/test/java/lang/ProcessBuilder/Basic.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/test/java/lang/ProcessBuilder/Basic.java	Mon Nov 09 09:05:20 2015 -0800
@@ -1248,7 +1248,7 @@
                 () -> p.toHandle(),
                 () -> p.supportsNormalTermination(),
                 () -> p.children(),
-                () -> p.allChildren());
+                () -> p.descendants());
 
     }
 
--- a/test/java/lang/ProcessHandle/OnExitTest.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/test/java/lang/ProcessHandle/OnExitTest.java	Mon Nov 09 09:05:20 2015 -0800
@@ -129,7 +129,7 @@
                 printf("         You can try to increase the timeout or%n");
                 printf("         you can try to use a faster VM (i.e. not a debug version).%n");
             }
-            children = getAllChildren(procHandle);
+            children = getDescendants(procHandle);
 
             ConcurrentHashMap<ProcessHandle, CompletableFuture<ProcessHandle>> completions =
                     new ConcurrentHashMap<>();
--- a/test/java/lang/ProcessHandle/PermissionTest.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/test/java/lang/ProcessHandle/PermissionTest.java	Mon Nov 09 09:05:20 2015 -0800
@@ -62,9 +62,9 @@
     }
 
     @Test
-    public void allChildrenWithPermission() {
+    public void descendantsWithPermission() {
         Policy.setPolicy(new TestPolicy(new RuntimePermission("manageProcess")));
-        currentHndl.allChildren();
+        currentHndl.descendants();
     }
 
     @Test
@@ -122,7 +122,7 @@
 
     @Test(groups = { "NoManageProcessPermission" }, expectedExceptions = SecurityException.class)
     public void noPermissionAllChildren() {
-        currentHndl.allChildren();
+        currentHndl.descendants();
     }
 
     @Test(groups = { "NoManageProcessPermission" }, expectedExceptions = SecurityException.class)
--- a/test/java/lang/ProcessHandle/ProcessUtil.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/test/java/lang/ProcessHandle/ProcessUtil.java	Mon Nov 09 09:05:20 2015 -0800
@@ -63,8 +63,8 @@
      * @param ph the Process to get children of
      * @return a list of child ProcessHandles
      */
-    public static List<ProcessHandle> getAllChildren(ProcessHandle ph) {
-        return ph.allChildren()
+    public static List<ProcessHandle> getDescendants(ProcessHandle ph) {
+        return ph.descendants()
                 .filter(ProcessUtil::isNotWindowsConsole)
                 .collect(Collectors.toList());
     }
@@ -117,7 +117,7 @@
                     // ignore
                 }
             }
-            subprocesses = getAllChildren(ph);
+            subprocesses = getDescendants(ph);
             count = subprocesses.size();
             System.out.printf(" waiting for subprocesses of %s to start," +
                     " expected: %d, current: %d%n", ph, nchildren, count);
@@ -133,7 +133,7 @@
      * @return the ProcessHandle
      */
     public static ProcessHandle destroyProcessTree(ProcessHandle p) {
-        Stream<ProcessHandle> children = p.allChildren().filter(ProcessUtil::isNotWindowsConsole);
+        Stream<ProcessHandle> children = p.descendants().filter(ProcessUtil::isNotWindowsConsole);
         children.forEach(ph -> {
             System.out.printf("destroyProcessTree destroyForcibly%n");
             printProcess(ph);
--- a/test/java/lang/ProcessHandle/TreeTest.java	Fri Nov 06 19:13:16 2015 +0300
+++ b/test/java/lang/ProcessHandle/TreeTest.java	Mon Nov 09 09:05:20 2015 -0800
@@ -193,21 +193,21 @@
             }
 
             // show the complete list of children (for debug)
-            List<ProcessHandle> allChildren = getAllChildren(p1Handle);
-            printf(" allChildren:  %s%n",
-                    allChildren.stream().map(p -> p.getPid())
-                            .collect(Collectors.toList()));
+            List<ProcessHandle> descendants = getDescendants(p1Handle);
+            printf(" descendants:  %s%n",
+                    descendants.stream().map(p -> p.getPid())
+                           .collect(Collectors.toList()));
 
-            // Verify that all spawned children show up in the allChildren List
+            // Verify that all spawned children show up in the descendants  List
             processes.forEach((p, parent) -> {
                 Assert.assertEquals(p.isAlive(), true, "Child should be alive: " + p);
-                Assert.assertTrue(allChildren.contains(p), "Spawned child should be listed in allChildren: " + p);
+                Assert.assertTrue(descendants.contains(p), "Spawned child should be listed in descendants: " + p);
             });
 
             // Closing JavaChild's InputStream will cause all children to exit
             p1.getOutputStream().close();
 
-            for (ProcessHandle p : allChildren) {
+            for (ProcessHandle p : descendants) {
                 try {
                     p.onExit().get();       // wait for the child to exit
                 } catch (ExecutionException e) {
@@ -228,9 +228,9 @@
     /**
      * Test destroy of processes.
      * A JavaChild is started and it starts three children.
-     * Each one is then checked to be alive and listed by allChildren
+     * Each one is then checked to be alive and listed by descendants
      * and forcibly destroyed.
-     * After they exit they should no longer be listed by allChildren.
+     * After they exit they should no longer be listed by descendants.
      */
     @Test
     public static void test3() {
@@ -263,24 +263,24 @@
             Assert.assertTrue(spawnCount.await(Utils.adjustTimeout(30L), TimeUnit.SECONDS),
                     "Timeout waiting for processes to start");
 
-            // Debugging; list allChildren that are not expected in processes
-            List<ProcessHandle> allChildren = ProcessUtil.getAllChildren(p1Handle);
-            long count = allChildren.stream()
+            // Debugging; list descendants that are not expected in processes
+            List<ProcessHandle> descendants = ProcessUtil.getDescendants(p1Handle);
+            long count = descendants.stream()
                     .filter(ph -> !processes.containsKey(ph))
                     .count();
             if (count > 0) {
-                allChildren.stream()
+                descendants.stream()
                     .filter(ph -> !processes.containsKey(ph))
                     .forEach(ph1 -> ProcessUtil.printProcess(ph1, "Extra process: "));
                 ProcessUtil.logTaskList();
-                Assert.assertEquals(0, count, "Extra processes in allChildren");
+                Assert.assertEquals(0, count, "Extra processes in descendants");
             }
 
-            // Verify that all spawned children are alive, show up in the allChildren list
+            // Verify that all spawned children are alive, show up in the descendants list
             // then destroy them
             processes.forEach((p, parent) -> {
                 Assert.assertEquals(p.isAlive(), true, "Child should be alive: " + p);
-                Assert.assertTrue(allChildren.contains(p), "Spawned child should be listed in allChildren: " + p);
+                Assert.assertTrue(descendants.contains(p), "Spawned child should be listed in descendants: " + p);
                 p.destroyForcibly();
             });
             Assert.assertEquals(processes.size(), newChildren, "Wrong number of children");
@@ -305,8 +305,8 @@
             p1.destroyForcibly();
             p1.waitFor();
 
-            // Verify that none of the spawned children are still listed by allChildren
-            List<ProcessHandle> remaining = getAllChildren(self);
+            // Verify that none of the spawned children are still listed by descendants
+            List<ProcessHandle> remaining = getDescendants(self);
             Assert.assertFalse(remaining.remove(p1Handle), "Child p1 should have exited");
             remaining = remaining.stream().filter(processes::containsKey).collect(Collectors.toList());
             Assert.assertEquals(remaining.size(), 0, "Subprocess(es) should have exited: " + remaining);
@@ -415,28 +415,28 @@
             Assert.assertTrue(spawnCount.await(Utils.adjustTimeout(30L), TimeUnit.SECONDS),
                     "Timeout waiting for processes to start");
 
-            // Debugging; list allChildren that are not expected in processes
-            List<ProcessHandle> allChildren = ProcessUtil.getAllChildren(p1Handle);
-            long count = allChildren.stream()
+            // Debugging; list descendants that are not expected in processes
+            List<ProcessHandle> descendants = ProcessUtil.getDescendants(p1Handle);
+            long count = descendants.stream()
                     .filter(ph -> !processes.containsKey(ph))
                     .count();
             if (count > 0) {
-                allChildren.stream()
+                descendants.stream()
                     .filter(ph -> !processes.containsKey(ph))
                     .forEach(ph1 -> ProcessUtil.printProcess(ph1, "Extra process: "));
                 ProcessUtil.logTaskList();
-                Assert.assertEquals(0, count, "Extra processes in allChildren");
+                Assert.assertEquals(0, count, "Extra processes in descendants");
             }
 
             Assert.assertEquals(getChildren(p1Handle).size(),
                     factor, "expected direct children");
-            count = getAllChildren(p1Handle).size();
+            count = getDescendants(p1Handle).size();
             long totalChildren = factor * factor * factor + factor * factor + factor;
             Assert.assertTrue(count >= totalChildren,
                     "expected at least " + totalChildren + ", actual: " + count);
 
-            List<ProcessHandle> subprocesses = getAllChildren(p1Handle);
-            printf(" allChildren:  %s%n",
+            List<ProcessHandle> subprocesses = getDescendants(p1Handle);
+            printf(" descendants:  %s%n",
                     subprocesses.stream().map(p -> p.getPid())
                     .collect(Collectors.toList()));
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/Arrays/ArraysEqCmpTest.java	Mon Nov 09 09:05:20 2015 -0800
@@ -0,0 +1,1083 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8033148
+ * @summary tests for array equals and compare
+ * @run testng ArraysEqCmpTest
+*/
+
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.lang.reflect.Array;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.function.BiFunction;
+import java.util.function.LongFunction;
+import java.util.stream.IntStream;
+
+public class ArraysEqCmpTest {
+
+    // Maximum width in bits
+    static final int MAX_WIDTH = 512;
+
+    static final Map<Class, Integer> typeToWidth;
+
+    static {
+        typeToWidth = new HashMap<>();
+        typeToWidth.put(boolean.class, Byte.SIZE);
+        typeToWidth.put(byte.class, Byte.SIZE);
+        typeToWidth.put(short.class, Short.SIZE);
+        typeToWidth.put(char.class, Character.SIZE);
+        typeToWidth.put(int.class, Integer.SIZE);
+        typeToWidth.put(long.class, Long.SIZE);
+        typeToWidth.put(float.class, Float.SIZE);
+        typeToWidth.put(double.class, Double.SIZE);
+        typeToWidth.put(Object.class, Integer.SIZE); // @@@ 32 or 64?
+    }
+
+    static int arraySizeFor(Class<?> type) {
+        type = type.isPrimitive() ? type : Object.class;
+        return 4 * MAX_WIDTH / typeToWidth.get(type);
+    }
+
+    static abstract class ArrayType<T> {
+        final Class<?> arrayType;
+        final Class<?> componentType;
+        final boolean unsigned;
+
+        final MethodHandle cpy;
+
+        final MethodHandle eq;
+        final MethodHandle eqr;
+        final MethodHandle cmp;
+        final MethodHandle cmpr;
+        final MethodHandle mm;
+        final MethodHandle mmr;
+
+        final MethodHandle getter;
+
+        final MethodHandle toString;
+
+        public ArrayType(Class<T> arrayType) {
+            this(arrayType, false);
+        }
+
+        public ArrayType(Class<T> arrayType, boolean unsigned) {
+            this.arrayType = arrayType;
+            this.componentType = arrayType.getComponentType();
+            this.unsigned = unsigned;
+
+            try {
+                MethodHandles.Lookup l = MethodHandles.lookup();
+
+                getter = MethodHandles.arrayElementGetter(arrayType);
+
+                if (componentType.isPrimitive()) {
+                    cpy = l.findStatic(Arrays.class, "copyOfRange",
+                                       MethodType.methodType(arrayType, arrayType, int.class, int.class));
+
+                    MethodType eqt = MethodType.methodType(
+                            boolean.class, arrayType, arrayType);
+                    MethodType eqrt = MethodType.methodType(
+                            boolean.class, arrayType, int.class, int.class, arrayType, int.class, int.class);
+
+                    eq = l.findStatic(Arrays.class, "equals", eqt);
+                    eqr = l.findStatic(Arrays.class, "equals", eqrt);
+
+                    String compareName = unsigned ? "compareUnsigned" : "compare";
+                    cmp = l.findStatic(Arrays.class, compareName,
+                                       eqt.changeReturnType(int.class));
+                    cmpr = l.findStatic(Arrays.class, compareName,
+                                        eqrt.changeReturnType(int.class));
+
+                    mm = l.findStatic(Arrays.class, "mismatch",
+                                       eqt.changeReturnType(int.class));
+                    mmr = l.findStatic(Arrays.class, "mismatch",
+                                       eqrt.changeReturnType(int.class));
+
+                    toString = l.findStatic(Arrays.class, "toString",
+                                            MethodType.methodType(String.class, arrayType));
+                }
+                else {
+                    cpy = l.findStatic(Arrays.class, "copyOfRange",
+                                       MethodType.methodType(Object[].class, Object[].class, int.class, int.class));
+
+                    MethodType eqt = MethodType.methodType(
+                            boolean.class, Object[].class, Object[].class);
+                    MethodType eqrt = MethodType.methodType(
+                            boolean.class, Object[].class, int.class, int.class, Object[].class, int.class, int.class);
+
+                    eq = l.findStatic(Arrays.class, "equals", eqt);
+                    eqr = l.findStatic(Arrays.class, "equals", eqrt);
+
+                    MethodType cmpt = MethodType.methodType(
+                            int.class, Comparable[].class, Comparable[].class);
+                    MethodType cmprt = MethodType.methodType(
+                            int.class, Comparable[].class, int.class, int.class, Comparable[].class, int.class, int.class);
+
+                    cmp = l.findStatic(Arrays.class, "compare", cmpt);
+                    cmpr = l.findStatic(Arrays.class, "compare", cmprt);
+
+                    mm = l.findStatic(Arrays.class, "mismatch",
+                                      eqt.changeReturnType(int.class));
+                    mmr = l.findStatic(Arrays.class, "mismatch",
+                                       eqrt.changeReturnType(int.class));
+
+                    toString = l.findStatic(Arrays.class, "toString",
+                                            MethodType.methodType(String.class, Object[].class));
+                }
+
+            }
+            catch (Exception e) {
+                throw new Error(e);
+            }
+        }
+
+        @Override
+        public String toString() {
+            String s = arrayType.getCanonicalName();
+            return unsigned ? "unsigned " + s : s;
+        }
+
+        Object construct(int length) {
+            return Array.newInstance(componentType, length);
+        }
+
+        Object copyOf(Object a) {
+            return copyOf(a, 0, Array.getLength(a));
+        }
+
+        Object copyOf(Object a, int from, int to) {
+            try {
+                return (Object) cpy.invoke(a, from, to);
+            }
+            catch (RuntimeException | Error e) {
+                throw e;
+            }
+            catch (Throwable t) {
+                throw new Error(t);
+            }
+        }
+
+        Object get(Object a, int i) {
+            try {
+                return (Object) getter.invoke(a, i);
+            }
+            catch (RuntimeException | Error e) {
+                throw e;
+            }
+            catch (Throwable t) {
+                throw new Error(t);
+            }
+        }
+
+        abstract void set(Object a, int i, Object v);
+
+        boolean equals(Object a, Object b) {
+            try {
+                return (boolean) eq.invoke(a, b);
+            }
+            catch (RuntimeException | Error e) {
+                throw e;
+            }
+            catch (Throwable t) {
+                throw new Error(t);
+            }
+        }
+
+        boolean equals(Object a, int aFromIndex, int aToIndex,
+                       Object b, int bFromIndex, int bToIndex) {
+            try {
+                return (boolean) eqr.invoke(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex);
+            }
+            catch (RuntimeException | Error e) {
+                throw e;
+            }
+            catch (Throwable t) {
+                throw new Error(t);
+            }
+        }
+
+        int compare(Object a, Object b) {
+            try {
+                return (int) cmp.invoke(a, b);
+            }
+            catch (RuntimeException | Error e) {
+                throw e;
+            }
+            catch (Throwable t) {
+                throw new Error(t);
+            }
+        }
+
+        int compare(Object a, int aFromIndex, int aToIndex,
+                    Object b, int bFromIndex, int bToIndex) {
+            try {
+                return (int) cmpr.invoke(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex);
+            }
+            catch (RuntimeException | Error e) {
+                throw e;
+            }
+            catch (Throwable t) {
+                throw new Error(t);
+            }
+        }
+
+        int mismatch(Object a, Object b) {
+            try {
+                return (int) mm.invoke(a, b);
+            }
+            catch (RuntimeException | Error e) {
+                throw e;
+            }
+            catch (Throwable t) {
+                throw new Error(t);
+            }
+        }
+
+        int mismatch(Object a, int aFromIndex, int aToIndex,
+                     Object b, int bFromIndex, int bToIndex) {
+            try {
+                return (int) mmr.invoke(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex);
+            }
+            catch (RuntimeException | Error e) {
+                throw e;
+            }
+            catch (Throwable t) {
+                throw new Error(t);
+            }
+        }
+
+        String toString(Object a) {
+            try {
+                return (String) toString.invoke(a);
+            }
+            catch (RuntimeException | Error e) {
+                throw e;
+            }
+            catch (Throwable t) {
+                throw new Error(t);
+            }
+        }
+
+        static class BoxedIntegers extends ArrayType<Integer[]> {
+            public BoxedIntegers() {
+                super(Integer[].class);
+            }
+
+            @Override
+            void set(Object a, int i, Object v) {
+                // Ensure unique reference
+                ((Integer[]) a)[i] = v != null ? new Integer((Integer) v) : null;
+            }
+        }
+
+        static class BoxedIntegersWithReverseComparator extends BoxedIntegers {
+            final Comparator<Integer> c = (a, b) -> {
+                // Nulls sort after non-nulls
+                if (a == null || b == null)
+                    return a == null ? b == null ? 0 : 1 : -1;
+
+                return Integer.compare(b, a);
+            };
+
+            final MethodHandle cmpc;
+            final MethodHandle cmpcr;
+            final MethodHandle mismatchc;
+            final MethodHandle mismatchcr;
+
+            public BoxedIntegersWithReverseComparator() {
+                try {
+                    MethodHandles.Lookup l = MethodHandles.lookup();
+
+                    MethodType cmpt = MethodType.methodType(
+                            int.class, Object[].class, Object[].class, Comparator.class);
+                    MethodType cmprt = MethodType.methodType(
+                            int.class, Object[].class, int.class, int.class,
+                            Object[].class, int.class, int.class, Comparator.class);
+
+                    cmpc = l.findStatic(Arrays.class, "compare", cmpt);
+                    cmpcr = l.findStatic(Arrays.class, "compare", cmprt);
+                    mismatchc = l.findStatic(Arrays.class, "mismatch", cmpt);
+                    mismatchcr = l.findStatic(Arrays.class, "mismatch", cmprt);
+                }
+                catch (Exception e) {
+                    throw new Error(e);
+                }
+            }
+
+            @Override
+            int compare(Object a, Object b) {
+                try {
+                    return (int) cmpc.invoke(a, b, c);
+                }
+                catch (RuntimeException | Error e) {
+                    throw e;
+                }
+                catch (Throwable t) {
+                    throw new Error(t);
+                }
+            }
+
+            @Override
+            int compare(Object a, int aFromIndex, int aToIndex,
+                        Object b, int bFromIndex, int bToIndex) {
+                try {
+                    return (int) cmpcr.invoke(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex, c);
+                }
+                catch (RuntimeException | Error e) {
+                    throw e;
+                }
+                catch (Throwable t) {
+                    throw new Error(t);
+                }
+            }
+
+            @Override
+            int mismatch(Object a, Object b) {
+                try {
+                    return (int) mismatchc.invoke(a, b, c);
+                }
+                catch (RuntimeException | Error e) {
+                    throw e;
+                }
+                catch (Throwable t) {
+                    throw new Error(t);
+                }
+            }
+
+            @Override
+            int mismatch(Object a, int aFromIndex, int aToIndex,
+                         Object b, int bFromIndex, int bToIndex) {
+                try {
+                    return (int) mismatchcr.invoke(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex, c);
+                }
+                catch (RuntimeException | Error e) {
+                    throw e;
+                }
+                catch (Throwable t) {
+                    throw new Error(t);
+                }
+            }
+
+            @Override
+            public String toString() {
+                return arrayType.getCanonicalName() + " with Comparator";
+            }
+        }
+
+        static class Booleans extends ArrayType<boolean[]> {
+            public Booleans() {
+                super(boolean[].class);
+            }
+
+            @Override
+            void set(Object a, int i, Object v) {
+                boolean pv;
+                if (v instanceof Boolean) {
+                    pv = (Boolean) v;
+                }
+                else if (v instanceof Integer) {
+                    pv = ((Integer) v) >= 0;
+                }
+                else throw new IllegalStateException();
+
+                ((boolean[]) a)[i] = pv;
+            }
+        }
+
+        static class Bytes extends ArrayType<byte[]> {
+            public Bytes(boolean unsigned) {
+                super(byte[].class, unsigned);
+            }
+
+            @Override
+            void set(Object a, int i, Object v) {
+                byte pv;
+                if (v instanceof Byte) {
+                    pv = (Byte) v;
+                }
+                else if (v instanceof Integer) {
+                    pv = ((Integer) v).byteValue();
+                }
+                else throw new IllegalStateException();
+
+                ((byte[]) a)[i] = pv;
+            }
+        }
+
+        static class Characters extends ArrayType<char[]> {
+            public Characters() {
+                super(char[].class);
+            }
+
+            @Override
+            void set(Object a, int i, Object v) {
+                char pv;
+                if (v instanceof Character) {
+                    pv = (Character) v;
+                }
+                else if (v instanceof Integer) {
+                    pv = (char) ((Integer) v).intValue();
+                }
+                else throw new IllegalStateException();
+
+                ((char[]) a)[i] = pv;
+            }
+        }
+
+        static class Shorts extends ArrayType<short[]> {
+            public Shorts(boolean unsigned) {
+                super(short[].class, unsigned);
+            }
+
+            @Override
+            void set(Object a, int i, Object v) {
+                short pv;
+                if (v instanceof Short) {
+                    pv = (Short) v;
+                }
+                else if (v instanceof Integer) {
+                    pv = ((Integer) v).shortValue();
+                }
+                else throw new IllegalStateException();
+
+                ((short[]) a)[i] = pv;
+            }
+        }
+
+        static class Integers extends ArrayType<int[]> {
+            public Integers(boolean unsigned) {
+                super(int[].class, unsigned);
+            }
+
+            @Override
+            void set(Object a, int i, Object v) {
+                int pv;
+                if (v instanceof Integer) {
+                    pv = ((Integer) v).shortValue();
+                }
+                else throw new IllegalStateException();
+
+                ((int[]) a)[i] = pv;
+            }
+        }
+
+        static class Longs extends ArrayType<long[]> {
+            public Longs(boolean unsigned) {
+                super(long[].class, unsigned);
+            }
+
+            @Override
+            void set(Object a, int i, Object v) {
+                long pv;
+                if (v instanceof Long) {
+                    pv = (Long) v;
+                }
+                else if (v instanceof Integer) {
+                    pv = ((Integer) v).longValue();
+                }
+                else throw new IllegalStateException();
+
+                ((long[]) a)[i] = pv;
+            }
+        }
+
+        static class Floats extends ArrayType<float[]> {
+            public Floats() {
+                super(float[].class);
+            }
+
+            @Override
+            void set(Object a, int i, Object v) {
+                float pv;
+                if (v instanceof Float) {
+                    pv = (Float) v;
+                }
+                else if (v instanceof Integer) {
+                    pv = ((Integer) v).floatValue();
+                }
+                else throw new IllegalStateException();
+
+                ((float[]) a)[i] = pv;
+            }
+        }
+
+        static class Doubles extends ArrayType<double[]> {
+            public Doubles() {
+                super(double[].class);
+            }
+
+            @Override
+            void set(Object a, int i, Object v) {
+                double pv;
+                if (v instanceof Double) {
+                    pv = (Double) v;
+                }
+                else if (v instanceof Integer) {
+                    pv = ((Integer) v).doubleValue();
+                }
+                else throw new IllegalStateException();
+
+                ((double[]) a)[i] = pv;
+            }
+        }
+    }
+
+    static Object[][] arrayTypes;
+
+    @DataProvider
+    public static Object[][] arrayTypesProvider() {
+        if (arrayTypes == null) {
+            arrayTypes = new Object[][]{
+                    new Object[]{new ArrayType.BoxedIntegers()},
+                    new Object[]{new ArrayType.BoxedIntegersWithReverseComparator()},
+                    new Object[]{new ArrayType.Booleans()},
+                    new Object[]{new ArrayType.Bytes(false)},
+                    new Object[]{new ArrayType.Bytes(true)},
+                    new Object[]{new ArrayType.Characters()},
+                    new Object[]{new ArrayType.Shorts(false)},
+                    new Object[]{new ArrayType.Shorts(true)},
+                    new Object[]{new ArrayType.Integers(false)},
+                    new Object[]{new ArrayType.Integers(true)},
+                    new Object[]{new ArrayType.Longs(false)},
+                    new Object[]{new ArrayType.Longs(true)},
+                    new Object[]{new ArrayType.Floats()},
+                    new Object[]{new ArrayType.Doubles()},
+            };
+        }
+        return arrayTypes;
+    }
+
+    static Object[][] floatArrayTypes;
+
+    @DataProvider
+    public static Object[][] floatArrayTypesProvider() {
+        if (floatArrayTypes == null) {
+            LongFunction<Object> bTof = rb -> Float.intBitsToFloat((int) rb);
+            LongFunction<Object> bToD = Double::longBitsToDouble;
+
+            floatArrayTypes = new Object[][]{
+                    new Object[]{new ArrayType.Floats(), 0x7fc00000L, 0x7f800001L, bTof},
+                    new Object[]{new ArrayType.Doubles(), 0x7ff8000000000000L, 0x7ff0000000000001L, bToD},
+            };
+        }
+        return floatArrayTypes;
+    }
+
+    static Object[][] objectArrayTypes;
+
+    @DataProvider
+    public static Object[][] objectArrayTypesProvider() {
+        if (objectArrayTypes == null) {
+            LongFunction<Object> bTof = rb -> Float.intBitsToFloat((int) rb);
+            LongFunction<Object> bToD = Double::longBitsToDouble;
+
+            objectArrayTypes = new Object[][]{
+                    new Object[]{new ArrayType.BoxedIntegers()},
+                    new Object[]{new ArrayType.BoxedIntegersWithReverseComparator()},
+            };
+        }
+        return objectArrayTypes;
+    }
+
+
+    static Object[][] signedUnsignedArrayTypes;
+
+    @DataProvider
+    public static Object[][] signedUnsignedArrayTypes() {
+        if (signedUnsignedArrayTypes == null) {
+            signedUnsignedArrayTypes = new Object[][]{
+                    new Object[]{new ArrayType.Bytes(false), new ArrayType.Bytes(true)},
+                    new Object[]{new ArrayType.Shorts(false), new ArrayType.Shorts(true)},
+                    new Object[]{new ArrayType.Integers(false), new ArrayType.Integers(true)},
+                    new Object[]{new ArrayType.Longs(false), new ArrayType.Longs(true)},
+            };
+        }
+        return signedUnsignedArrayTypes;
+    }
+
+    // Equality and comparison tests
+
+    @Test(dataProvider = "arrayTypesProvider")
+    public void testArray(ArrayType<?> arrayType) {
+        BiFunction<ArrayType<?>, Integer, Object> constructor = (at, s) -> {
+            Object a = at.construct(s);
+            for (int x = 0; x < s; x++) {
+                at.set(a, x, x % 8);
+            }
+            return a;
+        };
+
+        BiFunction<ArrayType<?>, Object, Object> cloner = (at, a) ->
+                constructor.apply(at, Array.getLength(a));
+
+        testArrayType(arrayType, constructor, cloner);
+    }
+
+    @Test(dataProvider = "floatArrayTypesProvider")
+    public void testPrimitiveFloatArray(
+            ArrayType<?> arrayType,
+            long canonicalNanRawBits, long nonCanonicalNanRawBits,
+            LongFunction<Object> bitsToFloat) {
+        Object canonicalNan = bitsToFloat.apply(canonicalNanRawBits);
+        // If conversion is a signalling NaN it may be subject to conversion to a
+        // quiet NaN on some processors, even if a copy is performed
+        // The tests assume that if conversion occurs it does not convert to the
+        // canonical NaN
+        Object nonCanonicalNan = bitsToFloat.apply(nonCanonicalNanRawBits);
+
+        BiFunction<ArrayType<?>, Integer, Object> canonicalNaNs = (at, s) -> {
+            Object a = at.construct(s);
+            for (int x = 0; x < s; x++) {
+                at.set(a, x, canonicalNan);
+            }
+            return a;
+        };
+
+        BiFunction<ArrayType<?>, Object, Object> nonCanonicalNaNs = (at, a) -> {
+            int s = Array.getLength(a);
+            Object ac = at.construct(s);
+            for (int x = 0; x < s; x++) {
+                at.set(ac, x, nonCanonicalNan);
+            }
+            return ac;
+        };
+
+        BiFunction<ArrayType<?>, Object, Object> halfNonCanonicalNaNs = (at, a) -> {
+            int s = Array.getLength(a);
+            Object ac = at.construct(s);
+            for (int x = 0; x < s / 2; x++) {
+                at.set(ac, x, nonCanonicalNan);
+            }
+            for (int x = s / 2; x < s; x++) {
+                at.set(ac, x, 1);
+            }
+            return ac;
+        };
+
+        testArrayType(arrayType, canonicalNaNs, nonCanonicalNaNs);
+        testArrayType(arrayType, canonicalNaNs, halfNonCanonicalNaNs);
+    }
+
+    @Test(dataProvider = "objectArrayTypesProvider")
+    public void testNullElementsInObjectArray(ArrayType<?> arrayType) {
+        BiFunction<ArrayType<?>, Object, Object> cloner = ArrayType::copyOf;
+
+        // All nulls
+        testArrayType(arrayType,
+                      (at, s) -> {
+                          Object a = at.construct(s);
+                          for (int x = 0; x < s; x++) {
+                              at.set(a, x, null);
+                          }
+                          return a;
+                      },
+                      cloner);
+
+
+        // Some nulls
+        testArrayType(arrayType,
+                      (at, s) -> {
+                          Object a = at.construct(s);
+                          for (int x = 0; x < s; x++) {
+                              int v = x % 8;
+                              at.set(a, x, v == 0 ? null : v);
+                          }
+                          return a;
+                      },
+                      cloner);
+
+        Integer[] a = new Integer[]{null, 0};
+        Integer[] b = new Integer[]{0, 0};
+        Assert.assertTrue(Arrays.compare(a, b) < 0);
+        Assert.assertTrue(Arrays.compare(b, a) > 0);
+    }
+
+    @Test(dataProvider = "objectArrayTypesProvider")
+    public void testSameRefElementsInObjectArray(ArrayType<?> arrayType) {
+        BiFunction<ArrayType<?>, Object, Object> cloner = ArrayType::copyOf;
+
+        // One ref
+        Integer one = 1;
+        testArrayType(arrayType,
+                      (at, s) -> {
+                          Integer[] a = (Integer[]) at.construct(s);
+                          for (int x = 0; x < s; x++) {
+                              a[x] = one;
+                          }
+                          return a;
+                      },
+                      cloner);
+
+        // All ref
+        testArrayType(arrayType,
+                      (at, s) -> {
+                          Integer[] a = (Integer[]) at.construct(s);
+                          for (int x = 0; x < s; x++) {
+                              a[x] = Integer.valueOf(s);
+                          }
+                          return a;
+                      },
+                      cloner);
+
+        // Some same ref
+        testArrayType(arrayType,
+                      (at, s) -> {
+                          Integer[] a = (Integer[]) at.construct(s);
+                          for (int x = 0; x < s; x++) {
+                              int v = x % 8;
+                              a[x] = v == 1 ? one : new Integer(v);
+                          }
+                          return a;
+                      },
+                      cloner);
+    }
+
+    @Test(dataProvider = "signedUnsignedArrayTypes")
+    public void testSignedUnsignedArray(ArrayType<?> sat, ArrayType<?> uat) {
+        BiFunction<ArrayType<?>, Integer, Object> constructor = (at, s) -> {
+            Object a = at.construct(s);
+            for (int x = 0; x < s; x++) {
+                at.set(a, x, 1);
+            }
+            return a;
+        };
+
+        int n = arraySizeFor(sat.componentType);
+
+        for (int s : ranges(0, n)) {
+            Object a = constructor.apply(sat, s);
+
+            for (int aFrom : ranges(0, s)) {
+                for (int aTo : ranges(aFrom, s)) {
+                    int aLength = aTo - aFrom;
+
+                    if (aLength > 0) {
+                        for (int i = aFrom; i < aTo; i++) {
+                            Object ac = sat.copyOf(a);
+                            // Create common prefix with a length of i - aFrom
+                            sat.set(ac, i, -1);
+
+                            int sc = sat.compare(ac, aFrom, aTo, a, aFrom, aTo);
+                            int uc = uat.compare(ac, aFrom, aTo, a, aFrom, aTo);
+
+                            Assert.assertTrue(sc < 0);
+                            Assert.assertTrue(uc > 0);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    void testArrayType(ArrayType<?> at,
+                       BiFunction<ArrayType<?>, Integer, Object> constructor,
+                       BiFunction<ArrayType<?>, Object, Object> cloner) {
+        int n = arraySizeFor(at.componentType);
+
+        for (int s : ranges(0, n)) {
+            Object a = constructor.apply(at, s);
+            Object b = cloner.apply(at, a);
+
+            for (int aFrom : ranges(0, s)) {
+                for (int aTo : ranges(aFrom, s)) {
+                    int aLength = aTo - aFrom;
+
+                    for (int bFrom : ranges(0, s)) {
+                        for (int bTo : ranges(bFrom, s)) {
+                            int bLength = bTo - bFrom;
+
+                            Object anr = at.copyOf(a, aFrom, aTo);
+                            Object bnr = at.copyOf(b, bFrom, bTo);
+
+                            boolean eq = isEqual(at, a, aFrom, aTo, b, bFrom, bTo);
+                            Assert.assertEquals(at.equals(a, aFrom, aTo, b, bFrom, bTo), eq);
+                            Assert.assertEquals(at.equals(b, bFrom, bTo, a, aFrom, aTo), eq);
+                            Assert.assertEquals(at.equals(anr, bnr), eq);
+                            Assert.assertEquals(at.equals(bnr, anr), eq);
+                            if (eq) {
+                                Assert.assertEquals(at.compare(a, aFrom, aTo, b, bFrom, bTo), 0);
+                                Assert.assertEquals(at.compare(b, bFrom, bTo, a, aFrom, aTo), 0);
+                                Assert.assertEquals(at.compare(anr, bnr), 0);
+                                Assert.assertEquals(at.compare(bnr, anr), 0);
+
+                                Assert.assertEquals(at.mismatch(a, aFrom, aTo, b, bFrom, bTo), -1);
+                                Assert.assertEquals(at.mismatch(b, bFrom, bTo, a, aFrom, aTo), -1);
+                                Assert.assertEquals(at.mismatch(anr, bnr), -1);
+                                Assert.assertEquals(at.mismatch(bnr, anr), -1);
+                            }
+                            else {
+                                int aCb = at.compare(a, aFrom, aTo, b, bFrom, bTo);
+                                int bCa = at.compare(b, bFrom, bTo, a, aFrom, aTo);
+                                int v = Integer.signum(aCb) * Integer.signum(bCa);
+                                Assert.assertTrue(v == -1);
+
+                                int anrCbnr = at.compare(anr, bnr);
+                                int bnrCanr = at.compare(bnr, anr);
+                                Assert.assertEquals(anrCbnr, aCb);
+                                Assert.assertEquals(bnrCanr, bCa);
+
+
+                                int aMb = at.mismatch(a, aFrom, aTo, b, bFrom, bTo);
+                                int bMa = at.mismatch(b, bFrom, bTo, a, aFrom, aTo);
+                                int anrMbnr = at.mismatch(anr, bnr);
+                                int bnrManr = at.mismatch(bnr, anr);
+
+                                Assert.assertNotEquals(aMb, -1);
+                                Assert.assertEquals(aMb, bMa);
+                                Assert.assertNotEquals(anrMbnr, -1);
+                                Assert.assertEquals(anrMbnr, bnrManr);
+                                Assert.assertEquals(aMb, anrMbnr);
+                                Assert.assertEquals(bMa, bnrManr);
+
+                                // Common or proper prefix
+                                Assert.assertTrue(at.equals(a, aFrom, aFrom + aMb, b, bFrom, bFrom + aMb));
+                                if (aMb < Math.min(aLength, bLength)) {
+                                    // Common prefix
+                                    Assert.assertFalse(isEqual(at, a, aFrom + aMb, b, bFrom + aMb));
+                                }
+                            }
+                        }
+                    }
+
+                    if (aLength > 0) {
+                        for (int i = aFrom; i < aTo; i++) {
+                            Object ac = at.copyOf(a);
+                            // Create common prefix with a length of i - aFrom
+                            at.set(ac, i, -1);
+
+                            Object acnr = at.copyOf(ac, aFrom, aTo);
+                            Object anr = at.copyOf(a, aFrom, aTo);
+
+                            Assert.assertFalse(at.equals(ac, aFrom, aTo, a, aFrom, aTo));
+                            Assert.assertFalse(at.equals(acnr, anr));
+
+                            int acCa = at.compare(ac, aFrom, aTo, a, aFrom, aTo);
+                            int aCac = at.compare(a, aFrom, aTo, ac, aFrom, aTo);
+                            int v = Integer.signum(acCa) * Integer.signum(aCac);
+                            Assert.assertTrue(v == -1);
+
+                            int acnrCanr = at.compare(acnr, anr);
+                            int anrCacnr = at.compare(anr, acnr);
+                            Assert.assertEquals(acnrCanr, acCa);
+                            Assert.assertEquals(anrCacnr, aCac);
+
+
+                            int acMa = at.mismatch(ac, aFrom, aTo, a, aFrom, aTo);
+                            int aMac = at.mismatch(a, aFrom, aTo, ac, aFrom, aTo);
+                            Assert.assertEquals(acMa, aMac);
+                            Assert.assertEquals(acMa, i - aFrom);
+
+                            int acnrManr = at.mismatch(acnr, anr);
+                            int anrMacnr = at.mismatch(anr, acnr);
+                            Assert.assertEquals(acnrManr, anrMacnr);
+                            Assert.assertEquals(acnrManr, i - aFrom);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    static boolean isEqual(ArrayType<?> at, Object a, int aFromIndex, int aToIndex,
+                           Object b, int bFromIndex, int bToIndex) {
+        int aLength = aToIndex - aFromIndex;
+        int bLength = bToIndex - bFromIndex;
+        if (aLength != bLength)
+            return false;
+
+        for (int i = 0; i < aLength; i++) {
+            Object av = at.get(a, aFromIndex++);
+            Object bv = at.get(b, bFromIndex++);
+            if (!Objects.equals(av, bv)) return false;
+        }
+
+        return true;
+    }
+
+    static boolean isEqual(ArrayType<?> at, Object a, int aFrom, Object b, int bFrom) {
+        Object av = at.get(a, aFrom);
+        Object bv = at.get(b, bFrom);
+
+        return Objects.equals(av, bv);
+    }
+
+    static int[] ranges(int from, int to) {
+        int width = to - from;
+        switch (width) {
+            case 0:
+                return new int[]{};
+            case 1:
+                return new int[]{from, to};
+            case 2:
+                return new int[]{from, from + 1, to};
+            case 3:
+                return new int[]{from, from + 1, from + 2, to};
+            default:
+                return IntStream.of(from, from + 1, from + 2, to / 2 - 1, to / 2, to / 2 + 1, to - 2, to - 1, to)
+                        .filter(i -> i >= from && i <= to)
+                        .distinct().toArray();
+        }
+    }
+
+
+    // Null array reference tests
+
+    @Test(dataProvider = "arrayTypesProvider")
+    public void testNullArrayRefs(ArrayType<?> arrayType) {
+        Object n = null;
+        Object a = arrayType.construct(0);
+
+        Assert.assertTrue(arrayType.equals(n, n));
+        Assert.assertFalse(arrayType.equals(n, a));
+        Assert.assertFalse(arrayType.equals(a, n));
+
+        Assert.assertEquals(arrayType.compare(n, n), 0);
+        Assert.assertTrue(arrayType.compare(n, a) < 0);
+        Assert.assertTrue(arrayType.compare(a, n) > 0);
+    }
+
+
+    // Exception throwing tests
+
+    @Test(dataProvider = "arrayTypesProvider")
+    public void testNPEs(ArrayType<?> arrayType) {
+        Object[] values = new Object[]{null, arrayType.construct(0)};
+
+        for (Object o1 : values) {
+            for (Object o2 : values) {
+                if (o1 != null && o2 != null)
+                    continue;
+
+                testNPE(() -> arrayType.equals(o1, 0, 0, o2, 0, 0));
+                testNPE(() -> arrayType.compare(o1, 0, 0, o2, 0, 0));
+                testNPE(() -> arrayType.mismatch(o1, o2));
+                testNPE(() -> arrayType.mismatch(o1, 0, 0, o2, 0, 0));
+            }
+        }
+    }
+
+    @Test
+    public void testObjectNPEs() {
+        String[][] values = new String[][]{null, new String[0]};
+        Comparator<String> c = String::compareTo;
+        Comparator[] cs = new Comparator[]{null, c};
+
+        for (String[] o1 : values) {
+            for (String[] o2 : values) {
+                for (Comparator o3 : cs) {
+                    if (o1 != null && o2 != null && o3 != null)
+                        continue;
+
+                    if (o3 == null) {
+                        testNPE(() -> Arrays.compare(o1, o2, o3));
+                        testNPE(() -> Arrays.mismatch(o1, o2, o3));
+                    }
+
+                    testNPE(() -> Arrays.compare(o1, 0, 0, o2, 0, 0, o3));
+                    testNPE(() -> Arrays.mismatch(o1, 0, 0, o2, 0, 0, o3));
+                }
+            }
+        }
+    }
+
+    @Test(dataProvider = "arrayTypesProvider")
+    public void testIAEs(ArrayType<?> arrayType) {
+        List<Integer> values = Arrays.asList(0, 1);
+
+        for (int s : values) {
+            Object a = arrayType.construct(s);
+
+            for (int o1 : values) {
+                for (int o2 : values) {
+                    if (o1 <= o2) continue;
+
+                    testIAE(() -> arrayType.equals(a, o1, 0, a, o2, 0));
+                    testIAE(() -> arrayType.compare(a, o1, 0, a, o2, 0));
+                    testIAE(() -> arrayType.mismatch(a, o1, 0, a, o2, 0));
+                }
+            }
+        }
+    }
+
+    @Test(dataProvider = "arrayTypesProvider")
+    public void testAIOBEs(ArrayType<?> arrayType) {
+        List<Integer> froms = Arrays.asList(-1, 0);
+
+        for (int s : Arrays.asList(0, 1)) {
+            List<Integer> tos = Arrays.asList(s, s + 1);
+            Object a = arrayType.construct(s);
+
+            for (int aFrom : froms) {
+                for (int aTo : tos) {
+                    for (int bFrom : froms) {
+                        for (int bTo : tos) {
+                            if (aFrom >= 0 && aTo <= s &&
+                                bFrom >= 0 && bTo <= s) continue;
+
+                            testAIOBE(() -> arrayType.equals(a, aFrom, aTo, a, bFrom, bTo));
+                            testAIOBE(() -> arrayType.compare(a, aFrom, aTo, a, bFrom, bTo));
+                            testAIOBE(() -> arrayType.mismatch(a, aFrom, aTo, a, bFrom, bTo));
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    static void testNPE(Runnable r) {
+        testThrowable(r, NullPointerException.class);
+    }
+
+    static void testIAE(Runnable r) {
+        testThrowable(r, IllegalArgumentException.class);
+    }
+
+    static void testAIOBE(Runnable r) {
+        testThrowable(r, ArrayIndexOutOfBoundsException.class);
+    }
+
+    static void testThrowable(Runnable r, Class<? extends Throwable> expected) {
+        Throwable caught = null;
+        try {
+            r.run();
+        }
+        catch (Throwable t) {
+            caught = t;
+        }
+        Assert.assertNotNull(caught);
+        Assert.assertTrue(expected.isInstance(caught));
+    }
+}
\ No newline at end of file