Java Reference
In-Depth Information
Implement the following method that returns the index of the row that
contains the most zeros.
2.18
public static int rowWithMostZeros( int [ ] [ ] arr )
Implement the various hasDuplicates methods, which all return true if
there are any duplicate entries in the specified group of elements.
2.19
public static boolean hasDuplicates( int [ ] arr )
public static boolean hasDuplicates( int [ ][ ] arr )
public static boolean hasDuplicates( String [ ] arr )
public static boolean hasDuplicates( ArrayList<String> arr )
Implement both howMany methods, which return the number of occur-
rences of val in arr .
2.20
public static int howMany( int [ ] arr, int val )
public static int howMany( int [ ][ ] arr, int val )
Implement both countChars methods, which return the number of
occurrences of ch in str .
2.21
public static int countChars( String str, char ch )
public static int countChars( String [ ] str, char ch )
Using the String method toLowerCase , which creates a new String that is
the lower case equivalent of an existing String (i.e., str.toLowerCase
2.22
()
returns a lower case equivalent of str , while leaving str unchanged), imple-
ment the getLowerCase and makeLowerCase methods below. getLowerCase
returns a new collection of String s, while makeLowerCase modifies the
existing collection.
public static String [ ] getLowerCase( String [ ] arr )
public static void makeLowerCase( String [ ] arr )
public static ArrayList<String> getLowerCase( ArrayList<String> arr )
public static void makeLowerCase( ArrayList<String> arr )
Method isIncreasing returns true if in each row of the two-dimensional
array, all entries monotonically increase, and in each column all entries
also monotonically increase. Implement isIncreasing .
2.23
public static boolean isIncreasing( int [ ] [ ] arr )
Implement method startsWith which returns an ArrayList containing
all the String sin arr that begin with character ch .
2.24
public ArrayList<String> startsWith( String [ ] arr, char ch )
Search WWH ::




Custom Search