SimpleLinkedList Count Equal
Create a public class CountLinkedList
that extends SimpleLinkedList
.
Provide an instance method countEqual
that accepts an Object
as a parameter and returns how many values in the
list are equal to the passed value as an int
. If the passed Object
is null
, throw an
IllegalArgumentException
.
As a reminder, our SimpleLinkedList
is composed of a chain of Item
s, where Item
is defined as an inner class
on SimpleLinkedList
:
The SimpleLinkedList
class also has a start
instance variable that refers to the start of the list, or null
if the list is empty. Note that the list that you are extending does not have a size
field or a get
method,
meaning that you will need to walk the list to solve this problem. (That's the point!)
Note that the SimpleLinkedList
variable start
and the Item
variables value
and next
are set up so that
you can access them directly, without using the normal settings and getters.