Question: Note, for - each is preferred, and should be used when possible. In java / * Given an array of Strings, return an ArrayList containing

Note, for-each is preferred, and should be used when possible.
In java
/*
Given an array of Strings, return an ArrayList containing the same Strings in the same order
array2List({"Apple", "Orange", "Banana"})->["Apple", "Orange", "Banana"]
array2List({"Red", "Orange", "Yellow"})->["Red", "Orange", "Yellow"]
array2List({"Left", "Right", "Forward", "Back"})->["Left", "Right", "Forward", "Back"]
*/
public List array2List(String[] stringArray){
return null;
}
/*
Given a list of Strings, return an array containing the same Strings in the same order
list2Array(["Apple", "Orange", "Banana"])->{"Apple", "Orange", "Banana"}
list2Array(["Red", "Orange", "Yellow"])->{"Red", "Orange", "Yellow"}
list2Array(["Left", "Right", "Forward", "Back"])->{"Left", "Right", "Forward", "Back"}
*/
public String[] list2Array(List stringList){
return null;
}
/*
Given an array of Strings, return an ArrayList containing the same Strings in the same order
except for any words that contain exactly 4 characters.
no4LetterWords({"Train", "Boat", "Car"})->["Train", "Car"]
no4LetterWords({"Red", "White", "Blue"})->["Red", "White"]
no4LetterWords({"Jack", "Jill", "Jane", "John", "Jim"})->["Jim"]
*/
public List no4LetterWords(String[] stringArray){
return null;
}
/*
Given an array of ints, divide each int by 2, and return an ArrayList of Doubles.
arrayInt2ListDouble({5,8,11,200,97})->[2.5,4.0,5.5,100,48.5]
arrayInt2ListDouble({745,23,44,9017,6})->[372.5,11.5,22,4508.5,3]
arrayInt2ListDouble({84,99,3285,13,877})->[42,49.5,1642.5,6.5,438.5]
*/
public List arrayInt2ListDouble(int[] intArray){
return null;
}
/*
Given a List of Integers, return the largest value.
findLargest([11,200,43,84,9917,4321,1,33333,8997])->33333
findLargest([987,1234,9381,731,43718,8932])->43718
findLargest([-2,-6,-8])->-2
*/
public Integer findLargest(List integerList){
return null;
}
/*
Given an array of Integers, return a List of Integers containing just the odd values.
oddOnly({112,201,774,92,9,83,41872})->[201,9,83]
oddOnly({1143,555,7,1772,9953,643})->[1143,555,7,9953,643]
oddOnly({734,233,782,811,3,9999})->[233,811,3,9999]
*/
public List oddOnly(Integer[] integerArray){
return null;
} no user input (scanner)

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!