The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
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<String> 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<String> 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<String> uppercased(List<String> 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<String> 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<String> filterContaining(List<String> 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<String> l) {
}
}