Package edu.ksu.cis.viewer
Class GenericConsList<E extends Serializable>
java.lang.Object
edu.ksu.cis.viewer.GenericConsList<E>
- Type Parameters:
E
- the type of the elements in the head of each list
- All Implemented Interfaces:
Serializable
An immutable linear recursive structure with a head and
a tail, which is a GenericConsList.
- Author:
- Rod Howell (rhowell@ksu.edu)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty GenericConsList.GenericConsList
(E h, GenericConsList<E> lst) Constructs a Generic ConsList with the given head and tail. -
Method Summary
-
Constructor Details
-
GenericConsList
public GenericConsList()Constructs an empty GenericConsList. -
GenericConsList
Constructs a Generic ConsList with the given head and tail. If the given tail isnull
, an empty GenericConsList is used in its place.- Parameters:
h
- the head of the listlst
- the tail of the list
-
-
Method Details
-
isEmpty
public boolean isEmpty()Returnstrue
if this list is empty.- Returns:
- whether this list is empty
-
getHead
Returns the head of this list.- Returns:
- the head of this list
- Throws:
EmptyListException
- If this list is empty.
-
getTail
Returns the tail of the list.- Returns:
- the tail of this list
- Throws:
EmptyListException
- If this list is empty.
-