Question
Need help with assignment in java IDE I need to add the following methods to my main.java: *The method called stringsBeginningWith should print all Strings
Need help with assignment in java IDE I need to add the following methods to my main.java:
*The method called stringsBeginningWith should print all Strings from the list that begin with c. In addition to the Stream methods, you can use the methods of the String class and System.out.println as part of the Stream method calls.
*The method called lowerAlphabetical should convert all Strings in the list to lowercase and print them out in alphabetical order. In addition to the Stream methods, you can use the methods of the String class and System.out.println as part of the Stream method calls.
*The method called tripleOddAverage should find the average of all odd integers in the list after they have been tripled. In addition to the Stream methods, you can use System.out.println as part of the Stream method calls.
*The method called findMinimum should find the minimum Integer in the list. You must use reduce to do this and cannot make use of the min method. In addition to the Stream methods, you can make a single call to System.out.println after the resulting minimum Integer has been found.
*The method called findMultiples should collect the first n multiples of the start value into a new List. As an example, if your start value is 2 and n is 4, your list should contain 2, 4, 6, and 8. You will need to look into the iterate and limit methods (part of the Stream API) in order to do this. After the new list has been created, use a separate Stream to print all the elements of the new list. You can use the method System.out.println as part of the Stream method calls.
Here is my main.java so far
import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream;
public class Main {
public static void stringsWithBeginning(List
} public static void lowerAlphabetical(List
} public static void tripleOddAverage(List
} public static void findMinimum(List
} public static void findMultiples(int start, int n) {
}
public static void main(String[] args) { stringsWithBeginning(Arrays.asList("apple", "banana", "artificial", "trust", "antique"), 'a'); lowerAlphabetical(Arrays.asList("ChErRy", "BaNaNa", "DrUmStIcK", "TrUsT", "AnTiQuE")); tripleOddAverage(Arrays.asList(9, 3, 4, 8, 2, 5, 1, 6, 7)); findMinimum(Arrays.asList(91, 13, 24, 38, 28, 51, 11, 26, 17)); findMultiples(14, 5); } }
Step 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