Question: Write a method named dataMatch() that takes as its parameter an array of integers and an ArrayList of integers, and returns true if the two

Write a method named dataMatch() that takes as its parameter an array of integers and an ArrayList of integers, and returns true if the two collections contain exactly the same values in the same order, and false otherwise.

Your solution should not create any additional arrays or ArrayLists, and should not modify the given array or ArrayList.

For example:

if array is {4, 1, 9} and list is [4, 1, 9], then dataMatch(array, list) should return true

if array is {3, 1, 9} and list is [3, 9, 1, 3], then dataMatch(array, list) should return false

if array is { } and list is [ ], then dataMatch(array, list) should return true

if array is {2, 2, 2, 2} and list is [2, 2, 2, 2, 99], then dataMatch(array, list) should return false

public static boolean dataMatch(int[] array, ArrayList list) { // Write this implementation }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!