Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE WRITE THIS IN JAVA Write a method int getSequencelndex(ArrayList, String first, String second), Or, int getSequencelndex(String[], String first, String second) The method goes through
PLEASE WRITE THIS IN JAVA
Write a method int getSequencelndex(ArrayList, String first, String second), Or, int getSequencelndex(String[], String first, String second) The method goes through the ArrayList or array, trying to find the sequence of the two Strings in the argument: first, then second. If the Arraylist or array does not have enough Strings to search for the sequence of the two Strings, or the sequence can't be found, the method returns 1. Otherwise, it returns the starting index of the first occurrence of sequence. Separately, you will write some calling code: a code segment that populates an ArrayList or array with five Strings that are building names of NIU, such as "Faraday". Then calls the method you wrote by passing in the ArrayList or array, and a sequence of your choice (e.g. first can be "Faraday", second can be "Adams", and print out its return valueStep 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