Lab 12 :: Interfaces and Generic Programs

There are two problems for this lab.

Problem 1:

In lectures we have seen a way to sort arrays of 'any' types. In this problem you are asked to write the binary search procedure for sorted arrays of 'any' type. You will need to add equality test method to the ComparatorObjects interface. Demonstrate your program using Person class (covered in lectures) and searching persons by names or ages.

Problem 2:

Write an interface for Stack of Objects. Provide two implementations of this interface, one using arrays and other using linked lists. Write a small test code in a separate class (call it Test.java) to test both the implementations.