Question: 1.Write a program that calls a. a method minToFront that takes an ArrayList of integers as a parameter. Themethod moves the minimum value in the
1.Write a program that calls a.
a method minToFront that takes an ArrayList of integers as a parameter. Themethod moves the minimum value in the list to the front, otherwise preserving theorder of the elements. For example, if a variable called list stores the followingvalues: [4, 7, 9, 2, 7, 7, 5, 3, 5, 1, 7, 8, 6, 7] and you make this call:minToFront(list); it should store the following values after the call: [1, 4, 7, 9,2, 7, 7, 5, 3, 5, 7, 8, 6, 7]. You may assume that the list stores at least one value.After the call print the list.
b.another method filterRange that accepts an ArrayList of integers and two integervalues min and max as parameters and removes all elements whose values are inthe range min through max (inclusive) from the list. For example, if a variablecalled list stores the values: [1, 4, 7, 9, 2, 7, 7, 5, 3, 5, 7, 8, 6, 7] The call of filterRange(list, 5, 7); should remove all values between 5 and 7, therefore it should change the list to store [1,4, 9, 2, 3, 8]. If no elements in range min-max are found in the list, the list's contents are unchanged. If an empty list is passed, the list remains empty. You may assume that the list is not null. After the call print the list.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
