Given Integer X Assumed List Write Method Returns Position Rst Occurrence X Positions Cou Q43887972

Given an integer x which is assumed to be in the lista, write a method that returns the position of the first occurrenceof x in a. Positions are counted as 0,1,2,…. If x does not appearin the list, you should throw an IllegalArgumentException.
static int find(int x, List<Integer> 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 Show transcribed image text 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
Expert Answer
Answer to Given an integer x which is assumed to be in the list a, write a method that returns the position of the first occurre…
OR