Question: Write a public static method named inRange that will take an ArrayList, and two additional int values as arguments. This method will return an ArrayList.

 Write a public static method named inRange that will take an

Write a public static method named inRange that will take an ArrayList, and two additional int values as arguments. This method will return an ArrayList. When called, and passed an ArrayList and a min value and a max value, this method will return an ArrayList containing all the elements in the argument ArrayList that are between the second argument value and the third argument value (inclusive). You can safely assume that the second argument value will always be less than or equal to the third argument value. The values in the returned ArrayList must be in the same order as they are in the argument ArrayList. Here are some examples: Example 1 Given: ArrayListmyList = new ArrayList>(); with these values {1,2,3,4,5}; inRange (myList, 2, 4) should return an ArrayList with these values {2,3,4} Example 2 Given: ArrayList myList = new ArrayList(); with these values {3,7,6,2,9,0,4,8}; inRange(myList, 3, 10) should return an ArrayList with these values {3,7,6,9,4,8} Example 3 Given: ArrayList> myList = new ArrayList>(); with these values {1,1,1}; inRange (myList, 1, 1) should return an ArrayList with these values {1,1,1} Helpful Info: - You may want to write a main method to call and test your required method

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!