Java 9 — Array equals, compare, mismatch method

Stuti Jain
Mar 31, 2021

--

Traditionally Arrays are everywhere.

Some of the common problems with arrays in earlier java implementations was on how to compare them.

prior to Java 8

post Java 8

problem here was if we want to test a particular sequence /subset within the array we still had to loop through it.

so Java 9 onwards we have overloaded definition

Similarly we have the compare function definitions to compare any two arrays

There is a new function in Java9 mismatch which returns the first index from where mismatch occurs/length of sequence upto which two arrays match.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response