Solve Exercise P16.4 recursively, by calling a recursive helper method private static boolean contains(Node start, Object
Question:
Solve Exercise •• P16.4 recursively, by calling a recursive helper method private static boolean contains(Node start, Object obj) If start is null, then it can’t contain the object. Otherwise, check start.data before recursively moving on to start.next.
Data from exercise P16.4
Add a method boolean contains(Object obj) that checks whether our LinkedList implementation contains a given object. Implement this method by directly traversing the links, not by using an iterator.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Question Posted: