Question: Need help coding this List. Lists are a lot like arrays, but youll be using get, set, add, size and the like instead of the

Need help coding this List. Lists are a lot like arrays, but youll be using get, set, add, size and the like instead of the array index operators [].

package list.exercises; import java.util.List; public class ListExercises {

/**

* Counts the number of characters in total across all strings in the supplied list;

* in other words, the sum of the lengths of the all the strings.

* @param l a non-null list of strings

* @return the number of characters

*/

public static int countCharacters(List l) {

return 0; }

/**

* Splits a string into words and returns a list of the words.

* If the string is empty, split returns a list containing an empty string.

*

* @param s a non-null string of zero or more words

* @return a list of words

*/

public static List split(String s) { return null; }

/**

* Returns a copy of the list of strings where each string has been

* uppercased (as by String.toUpperCase).

*

* The original list is unchanged.

*

* @param l a non-null list of strings

* @return a list of uppercased strings

*/

public static List uppercased(List l) {

return null;

}

/**

* Returns true if and only if each string in the supplied list of strings

* starts with an uppercase letter. If the list is empty, returns false.

*

* @param l a non-null list of strings

* @return true iff each string starts with an uppercase letter

*/

public static boolean allCapitalizedWords(List l) {

return false;

}

/**

* Returns a list of strings selected from a supplied list, which contain the character c.

*

* The returned list is in the same order as the original list, but it omits all strings

* that do not contain c.

*

* The original list is unmodified.

*

* @param l a non-null list of strings

* @param c the character to filter on

* @return a list of strings containing the character c, selected from l

*/

public static List filterContaining(List l, char c) {

return null;

}

/**

* Inserts a string into a sorted list of strings, maintaining the sorted property of the list.

*

* @param s the string to insert

* @param l a non-null, sorted list of strings

*/

public static void insertInOrder(String s, List l) {

}

}

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!