Exercises
21.6 (Concatenating Lists) Write a program that concatenates two linked list objects of characters. Class ListConcatenate
should include a static
method concatenate
that takes references to both list objects as arguments and concatenates the second list to the first list.
21.7 (Inserting into an Ordered List) Write a program that inserts 25 random integers from 0 to 100 in order into a linked-list object. For this exercise, you’ll need to modify the List<T>
class (Fig. 21.3) to maintain an ordered list. Name the new version of the class SortedList
.
21.8 (Merging Ordered Lists) Modify the SortedList
class from Exercise 21.7 to include a merge
method that can merge the SortedList
it receives as an argument with the SortedList
that calls ...
Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.