VideosMy ProjectsProgramming BlogGallery
  1. Home
  2. Blog
  3. Compare arrays with Java
Programming Blog

Atom/RSS Feed

java

Compare arrays with Java

java

There are many such use cases where you will find yourself required to compare two arrays in Java.

Remembering a few of the different ways to do so is a tool which should be in any programmers toolbox.

Compare using Java 8

IntStream.range(0, arr.length)
    .forEach((i) -> arr[i] == b.get(i))

Compare using Java 5+

return Arrays.deepEquals(arr1, arr2);
Join my mailing list