Write a class arraysearchltegt that has two methods - the


Program: Write a class, ArraySearch that has two methods:

1. static int find (E [] haystack, E needle);

2. static int first_duplicate (E [] data);

The find method searches the haystack array to see if the elements within are the same, which is determined by the equals method, as the needle.

If the search finds a match, find returns the index that belongs to the first match. If not, find throws the exception java.util.MissingResourceException.

The method first_duplicate searches the data array to see if any two different elements of the array are the same evaluated by the equals method. The return value is the index of the first duplicate found, or -1 if each of the elements of the array is unique,

**no element of the array is equal to any other element of the array**

There should be code to test this ArraySearch class and be sure to include comments. The comment should describe the purpose of the program and the data to be entered.

Request for Solution File

Ask an Expert for Answer!!
Data Structure & Algorithms: Write a class arraysearchltegt that has two methods - the
Reference No:- TGS0951379

Expected delivery within 24 Hours