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, ArrayListlist) { // Write this implementation }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started