44
55/**
66 * A utility class to help do things.
7+ *
8+ * @author Samasaur
79 */
810public final class Utilities {
911 /**
@@ -14,10 +16,11 @@ private Utilities() throws Exception {
1416 }
1517
1618 /**
17- * A method that takes a string and capitalizes it correctly (e.g. eXamPLe → Example).
19+ * Returns a correctly capitalized string.
20+ * If it is empty or null, it is returned unchanged.
1821 *
1922 * @param original The string to be capitalized.
20- * @return A capitalized version of the parameter .
23+ * @return A capitalized version of the passed string .
2124 */
2225 public static String capitalize (String original ) {
2326 if (original == null ) return null ; //Make sure we weren't passed null.
@@ -32,7 +35,7 @@ public static String capitalize(String original) {
3235 }
3336
3437 /**
35- * A method that takes some number of integers and returns the average of them
38+ * Returns the average of an array of integers.
3639 *
3740 * @param values The ints to take the average of.
3841 * @return The average of the parameters.
@@ -67,10 +70,10 @@ public static <K, V> Map<K, V> generateMap(ArrayList<K> keys, ArrayList<V> value
6770 }
6871
6972 /**
70- * Removes profanity from a given string.
73+ * Removes profanity from a given string. Strings that are either empty or null will be returned unchanged.
7174 *
72- * @param original The string to 'clean'.
73- * @return The cleaned string.
75+ * @param original The string to 'clean'. If this is null, this method returns null. If it is empty, it is returned unchanged.
76+ * @return The cleaned string. This is the original string, with any profane words (separated by nonalphabetic characters) replaced by * characters.
7477 */
7578 public static String removeProfanity (String original ) {
7679 if (original == null ) return null ;
@@ -81,12 +84,17 @@ public static String removeProfanity(String original) {
8184 }
8285
8386 /**
84- * Removes profanity from every string in a given ArrayList.
87+ * Removes profanity from every string in a given List.
88+ * Strings that are either empty or null will be returned unchanged. If the List is empty or null, it will be returned unchanged.
89+ * <p>
90+ * For every string in this List, the {@link #removeProfanity(String)} method is called on it.
8591 *
86- * @param original The ArrayList to 'clean'.
87- * @return The cleaned ArrayList.
92+ * @param original The List to 'clean'. If this is null, this method returns null. If it is empty, it is returned unchanged.
93+ * @return The cleaned List. Each string in it has been cleansed.
94+ * @see #removeProfanity(String)
95+ * @since 1.4
8896 */
89- public static ArrayList <String > removeProfanity (ArrayList <String > original ) {
97+ public static List <String > removeProfanity (List <String > original ) {
9098 if (original == null ) return null ;
9199 for (int i = 0 ; i < original .size (); i ++) {
92100 original .set (i , removeProfanity (original .get (i )));
0 commit comments