Class Poly.NonEmptyList
All Packages Class Hierarchy This Package Previous Next Index
Class Poly.NonEmptyList
java.lang.Object
|
+----Poly.List
|
+----Poly.NonEmptyList
- public class NonEmptyList
- extends List
NonEmptyList is the sub-class of List consisting of non-empty
lists. Every NonEmptyList has a first and a rest.
-
NonEmptyList(Object, List)
- NonEmptyList is the constructor for a List, given a First and a Rest.
-
NonEmptyList(Object, Seed)
-
-
first()
- first() returns the first element of a NonEmptyList.
-
getNonEmpty()
- getNonEmpty() returns this list.
-
isEmpty()
- isEmpty() tells whether the List is empty.
-
nonEmpty()
- nonEmpty() tells whether the List is non-empty.
-
rest()
- rest() returns the rest of a NonEmptyList.
-
setFirst(Object)
- setFirst() sets the first element of a NonEmptyList.
-
toString()
- toString() converts List to string, e.g.
NonEmptyList
public NonEmptyList(Object First,
List Rest)
- NonEmptyList is the constructor for a List, given a First and a Rest.
Use static method cons to avoid using 'new' explicitly.
NonEmptyList
public NonEmptyList(Object First,
Seed Rest)
isEmpty
public boolean isEmpty()
- isEmpty() tells whether the List is empty.
- Overrides:
- isEmpty in class List
nonEmpty
public boolean nonEmpty()
- nonEmpty() tells whether the List is non-empty.
- Overrides:
- nonEmpty in class List
first
public Object first()
- first() returns the first element of a NonEmptyList.
- Throws: EmptyListException
- is never thrown.
- Overrides:
- first in class List
rest
public List rest()
- rest() returns the rest of a NonEmptyList.
- Throws: EmptyListException
- is never thrown.
- Overrides:
- rest in class List
getNonEmpty
public NonEmptyList getNonEmpty()
- getNonEmpty() returns this list.
- Throws: EmptyListException
- is never thrown.
- Overrides:
- getNonEmpty in class List
toString
public String toString()
- toString() converts List to string, e.g. for printing
- Overrides:
- toString in class List
setFirst
public void setFirst(Object value)
- setFirst() sets the first element of a NonEmptyList.
All Packages Class Hierarchy This Package Previous Next Index