Question: Given an integer x which is assumed to be in the list a, write a method that returns the position of the rst occurrence of

 Given an integer x which is assumed to be in the

Given an integer x which is assumed to be in the list a, write a method that returns the position of the rst occurrence of x in a. Positions are counted as 0,1,2,.... If x does not appear in the list, you should throw an IllegalArgumentException.

static int find(int x, List a) Given an integer x which is assumed to be in the list a, write a method that returns the position of the first occurrence of u in a. Positions are counted as 0, 1, 2, .... If x does not appear in the list, you should throw an IllegalArgumentException. Examples: x: 3 x: 2 a: [7, 5, 3, 8] a: [7, 5, 3, 8] ==> 2 ==> IllegalArgumentException

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!