Question: *Write a Method In Java StringArrayList containsPrefix(String pre) returns a StringArrayList object containing String objects that starts with the String stored in pre. Example: Let
*Write a Method In Java
StringArrayList containsPrefix(String pre) returns a StringArrayList object containing String objects that starts with the String stored in pre. Example: Let list be a StringArrayList object containing the following String values: {"aes", "bassefj","cs33", "d32", "aest67", "23232", "aesbbn+", "aesss", "8+9aes","aesr2", "09-tt3", "3aes", "aessssss", "bddfds"} The expression, list.containsPrefix("aes"), returns a StringArrayList object containing the following String values: {aes, aest67, aesbbn+, aesss, aesr2, aessssss}
Hint: Use for loop and a method startsWith() for objects in array list.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
