Java Reference
In-Depth Information
19.6
( Maximum element in a two-dimensional array ) Write a generic method that
returns the maximum element in a two-dimensional array.
public static <E extends Comparable<E>> E max(E[][] list)
19.7
( Generic binary search ) Implement the following method using binary search.
public static <E extends Comparable<E>>
int binarySearch(E[] list, E key)
19.8
( Shuffle ArrayList ) Write the following method that shuffles an ArrayList :
public static <E> void shuffle(ArrayList<E> list)
19.9
( Sort ArrayList ) Write the following method that sorts an ArrayList :
public static <E extends Comparable<E>>
void sort(ArrayList<E> list)
19.10
( Largest element in ArrayList ) Write the following method that returns the largest
element in an ArrayList :
public static <E extends Comparable<E>> E max(ArrayList<E> list)
19.11
( ComplexMatrix ) Use the Complex class introduced in Programming
Exercise 13.17 to develop the ComplexMatrix class for performing matrix opera-
tions involving complex numbers. The ComplexMatrix class should extend the
GenericMatrix class and implement the add , multiple , and zero methods.
You need to modify GenericMatrix and replace every occurrence of Number by
Object , because Complex is not a subtype of Number . Write a test program that
creates the following two matrices and displays the result of addition and multiplica-
tion of the matrices by invoking the printResult method.
 
 
Search WWH ::




Custom Search