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.

Constructor Index

 o NonEmptyList(Object, List)
NonEmptyList is the constructor for a List, given a First and a Rest.
 o NonEmptyList(Object, Seed)

Method Index

 o first()
first() returns the first element of a NonEmptyList.
 o getNonEmpty()
getNonEmpty() returns this list.
 o isEmpty()
isEmpty() tells whether the List is empty.
 o nonEmpty()
nonEmpty() tells whether the List is non-empty.
 o rest()
rest() returns the rest of a NonEmptyList.
 o setFirst(Object)
setFirst() sets the first element of a NonEmptyList.
 o toString()
toString() converts List to string, e.g.

Constructors

 o 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.
 o NonEmptyList
  public NonEmptyList(Object First,
                      Seed Rest)

Methods

 o isEmpty
  public boolean isEmpty()
isEmpty() tells whether the List is empty.
Overrides:
isEmpty in class List
 o nonEmpty
  public boolean nonEmpty()
nonEmpty() tells whether the List is non-empty.
Overrides:
nonEmpty in class List
 o first
  public Object first()
first() returns the first element of a NonEmptyList.
Throws: EmptyListException
is never thrown.
Overrides:
first in class List
 o rest
  public List rest()
rest() returns the rest of a NonEmptyList.
Throws: EmptyListException
is never thrown.
Overrides:
rest in class List
 o getNonEmpty
  public NonEmptyList getNonEmpty()
getNonEmpty() returns this list.
Throws: EmptyListException
is never thrown.
Overrides:
getNonEmpty in class List
 o toString
  public String toString()
toString() converts List to string, e.g. for printing
Overrides:
toString in class List
 o setFirst
  public void setFirst(Object value)
setFirst() sets the first element of a NonEmptyList.

All Packages  Class Hierarchy  This Package  Previous  Next  Index