public class Utility2C extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
areReversed(String s,
String t)
Returns true if the string t is equal to the string s
in reverse, and false otherwise.
|
static char |
last(String s)
Returns the last character in the argument string.
|
static List<Character> |
repeatedChars(String s)
Returns a list of the characters that appear more than once
in the string s.
|
public static char last(String s)
s
- a stringpublic static boolean areReversed(String s, String t)
Utility2C.areReversed("abcd", "dcba")
returns true.
s
- a non-null stringt
- a non-null stringIllegalArgumentException
- if the length of
s is not equal to the length of tpublic static List<Character> repeatedChars(String s)
Utility2C.repeatedChars("hi") returns the empty list Utility2C.repeatedChars("EECS") returns the list ['E'] Utility2C.repeatedChars("EECS2030") returns the list ['E', '0']
s
- a non-null string