Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions

Question

Oauth2.0 HTTPS error code, code written in java.

Answered: 1 week ago

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago