name.panitz.eliza
Interface Li<a>

All Known Implementing Classes:
LiImpl, Map

public interface Li<a>

An abstract description of a simple linked list.


Method Summary
 Li<a> append(Li<a> that)
          Appends two list.
 Li<a> concat(Li<a> that)
          Just another name for method append
 Li<a> drop(int i)
          Removes the first i elements from a list.
 Li<a> filter(FilterCondition<a> cond)
          Creates a list with all elements that fullfill the condition.
 a head()
          Returns the first element of this list.
 boolean isEmpty()
          Tests, if the list contains some element.
 int length()
           
 Li<a> reverse()
          Reverses the element order of the list.
 void rotate()
          Mutates this list, by appending first element as last.
 Li<a> tail()
          Returns the list after the first element has been skipped.
 Li<Li<a>> tails()
          Makes a list of lists of all taillists.
 java.lang.String unwords()
          Makes a list to a String adding whitespace between the list elements.
 

Method Detail

isEmpty

boolean isEmpty()
Tests, if the list contains some element.

Returns:
true if no element is contained in the list.

head

a head()
Returns the first element of this list.

Returns:
from element.

tail

Li<a> tail()
Returns the list after the first element has been skipped.

Returns:
the tail (rest) of the list, which follows first element.

length

int length()
Returns:
the number of elements in this list.

append

Li<a> append(Li<a> that)
Appends two list. Thus not modify this or that.

Parameters:
that - list which is appended to this for creating result
Returns:
a new list which is the concatenation of this with that.

concat

Li<a> concat(Li<a> that)
Just another name for method append

Returns:
a new list which is the concatenation of this with that.

filter

Li<a> filter(FilterCondition<a> cond)
Creates a list with all elements that fullfill the condition.

Parameters:
cond - Condition to test if element is to be in result list.
Returns:
list with elements that fullfill condition.

tails

Li<Li<a>> tails()
Makes a list of lists of all taillists. example: for the list ("this","is","a","test") this produces: (("this","is","a","test"),("is","a","test"),("a","test"),("test"))

Returns:
a list of lists, which contains all list obtained from this list through several calls of tail().

drop

Li<a> drop(int i)
Removes the first i elements from a list.

Parameters:
i - a positive number of elements to be skipped from the beginning of the list.
Returns:
this list with i elements dropped by tail calls.

reverse

Li<a> reverse()
Reverses the element order of the list. example: ("a","b","c") gets ("c","b","a")

Returns:
a new list with reversed element order of this list.

rotate

void rotate()
Mutates this list, by appending first element as last.


unwords

java.lang.String unwords()
Makes a list to a String adding whitespace between the list elements. This is a reverse function to ListUtil.words. example: unwords for a list: ("this","is","a","test") produces the String: "this is a test"

Returns:
a string which concatenates the Strings of this list with whitespace characters.