Modify the Cage class to implement Comparable. The definition of the Comparable interface can be found here. Remember that Comparable has...
Search Results
Searching for: generic
Individual Exercises
Using generics in your program can be very useful considering generic methods and generic classes can handle different datatypes....
You have been handed a mysterious piece of data by an unknown person. Judging by his shifty eyes and maniacal laughter you don't think he...
Given a class Answer<E>, write a method that converts argument e into String and returns that value. If the value is a primitve, (...
The LinearNode class is used to represent the individual nodes in a linear LinkedList. This particular LinkedList is doubly linked....
For this question you will be writing a method reverse that takes in two parameters.
public T[] reverse(T[] arr, T[] reversedArr) The...
For this question you will be writing a method truncate that takes in two parameters.
public T[] truncate(T[] arr, T[] truncatedArr) The...
For this question, you will be given all the code necessary except the parameter. This method needs to take in a List of any type of...
For this question, you will need to both write the method and add in the correct parameter.
This method needs to take in a List of any...
Using the Box class described in the reading assignment, create an instance of Box that can hold the value 4.2, then return that Box.
...
Using the Box class described in the reading assignment, create an instace of Box that can hold the generic value passed in as a...
The following method takes in a list of objects, but the type of objects are specified by the generic type parameter T. It also takes a...
The following question makes use of the generic Box class discussed in the reading assignment.
public static class Box<T> { private...
The following method will appear in a class with a generic type parameter T. It takes in a 2D array of elements of that generic type T,...