universe
Class Empty<X>
java.lang.Object
universe.List<X>
universe.Empty<X>
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Iterable<X>
public class Empty<X>
- extends List<X>
Represents the Empty List. You should not use the constructor. To create an
empty list please use List.create(). You Can usually get away without
the type parameter depending on the context.
- See Also:
- Serialized Form
Nested classes/interfaces inherited from class universe.List |
List.Build<X>, List.Comp<X>, List.Fold<X,Y>, List.GComp<X,Y>, List.Map<X,Y>, List.Pred<X>, List.Stringer<X>, List.Zip<X,Y,Z> |
Constructor Summary |
Empty()
|
Method Summary |
List<X> |
add(X t,
int i)
Add an Element to this list at the given index |
List<X> |
append(List<X> l)
Append another List to the end of this List |
List<X> |
append(X t)
Append an element to the end of this List |
boolean |
contains(List.Pred<X> p)
Does this Predicate match anything in this List? |
boolean |
contains(X t)
Does the given X occur in this List? |
boolean |
containsAll(List<X> l)
Does this List contain all of the given List's Elements? |
boolean |
containsAll(List<X> l,
List.Comp<X> c)
Does this List contain all of the given List's Elements using the given comparer? |
boolean |
containsAny(List<X> l)
Does this List contain any of the given List's Elements? |
boolean |
equals(java.lang.Object o)
Equals for Lists... |
List<X> |
filter(List.Pred<X> p)
Filter out all the non-matching Elements |
X |
find(List.Pred<X> p)
Return the first matching X, throws a RuntimeException if not there |
X |
find(X t)
Return the given X, throws a RuntimeException if not there |
|
foldl(List.Fold<X,Y> f,
Y b)
Fold this List to a single Value (Left to Right) |
|
foldr(List.Fold<X,Y> f,
Y b)
Fold this List to a single Value (Right to Left) |
int |
hashCode()
HashCode for Lists... |
List<X> |
insert(X a,
List.Comp<X> c)
Insert an Element into this SORTED list using the given Comparison |
boolean |
isEmpty()
Is this List Empty? |
int |
length()
The Length of This List |
X |
lookup(int i)
Lookup the i^th item in this List |
|
map(List.Map<X,Y> m)
Apply a function to each Element of this List |
List<X> |
pop()
Return this List without the first Element |
List<X> |
remove(int i)
Remove an Element from this list at the given index |
List<X> |
remove(List.Pred<X> p)
Remove the first matching X |
List<X> |
remove(X t)
Remove the first occurence of the given X |
List<X> |
replace(int t,
X s)
Replace the element at index 'i' with 's' |
List<X> |
replace(List.Pred<X> p,
X t)
Replace the first matching X with 's' |
List<X> |
replace(X t,
X s)
Replace the first occurrence of 't' with 's' |
List<X> |
replaceAll(List.Pred<X> p,
X t)
Replace all matching Xs with 't' |
List<X> |
replaceAll(X t,
X s)
Replace all occurrences of 't' with 's' |
List<X> |
sort(List.Comp<X> c)
Sort this List using the given Comparison |
X |
top()
Return the first Element of this List |
java.lang.String |
toString(List.Stringer<X> s)
To String using a Stringer (Visitor) |
java.lang.String |
toString(java.lang.String sep,
java.lang.String pre)
To String, with a separator and prefix |
|
zip(List.Zip<X,Y,Z> z,
List<Y> l)
Zip two lists (this, and 'l') into a single list, one element at a time |
Methods inherited from class universe.List |
andmap, buildlist, containsAllG, containsAny, containsAnyG, containsG, count, create, create, create, create, create, filter, filterout, filterout, findG, fold, index, index, insert, insertionSort, iterator, main, ormap, pop, push, push, removeDuplicates, removeDuplicates, removeG, reverse, reverse, same, same, sameG, shuffle, sublist, toArray, toJavaList, toString |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Empty
public Empty()
top
public X top()
- Description copied from class:
List
- Return the first Element of this List
- Specified by:
top
in class List<X>
pop
public List<X> pop()
- Description copied from class:
List
- Return this List without the first Element
- Specified by:
pop
in class List<X>
isEmpty
public boolean isEmpty()
- Description copied from class:
List
- Is this List Empty?
- Specified by:
isEmpty
in class List<X>
equals
public boolean equals(java.lang.Object o)
- Description copied from class:
List
- Equals for Lists...
- Specified by:
equals
in class List<X>
hashCode
public int hashCode()
- Description copied from class:
List
- HashCode for Lists...
- Specified by:
hashCode
in class List<X>
append
public List<X> append(List<X> l)
- Description copied from class:
List
- Append another List to the end of this List
- Overrides:
append
in class List<X>
append
public List<X> append(X t)
- Description copied from class:
List
- Append an element to the end of this List
- Overrides:
append
in class List<X>
contains
public boolean contains(X t)
- Description copied from class:
List
- Does the given X occur in this List?
- Overrides:
contains
in class List<X>
contains
public boolean contains(List.Pred<X> p)
- Description copied from class:
List
- Does this Predicate match anything in this List?
- Overrides:
contains
in class List<X>
containsAny
public boolean containsAny(List<X> l)
- Description copied from class:
List
- Does this List contain any of the given List's Elements?
- Overrides:
containsAny
in class List<X>
containsAll
public boolean containsAll(List<X> l)
- Description copied from class:
List
- Does this List contain all of the given List's Elements?
- Overrides:
containsAll
in class List<X>
containsAll
public boolean containsAll(List<X> l,
List.Comp<X> c)
- Description copied from class:
List
- Does this List contain all of the given List's Elements using the given comparer?
- Overrides:
containsAll
in class List<X>
find
public X find(X t)
- Description copied from class:
List
- Return the given X, throws a RuntimeException if not there
- Overrides:
find
in class List<X>
find
public X find(List.Pred<X> p)
- Description copied from class:
List
- Return the first matching X, throws a RuntimeException if not there
- Overrides:
find
in class List<X>
remove
public List<X> remove(X t)
- Description copied from class:
List
- Remove the first occurence of the given X
- Overrides:
remove
in class List<X>
remove
public List<X> remove(List.Pred<X> p)
- Description copied from class:
List
- Remove the first matching X
- Overrides:
remove
in class List<X>
length
public int length()
- Description copied from class:
List
- The Length of This List
- Overrides:
length
in class List<X>
lookup
public X lookup(int i)
- Description copied from class:
List
- Lookup the i^th item in this List
- Overrides:
lookup
in class List<X>
toString
public java.lang.String toString(java.lang.String sep,
java.lang.String pre)
- Description copied from class:
List
- To String, with a separator and prefix
- Overrides:
toString
in class List<X>
toString
public java.lang.String toString(List.Stringer<X> s)
- Description copied from class:
List
- To String using a Stringer (Visitor)
- Overrides:
toString
in class List<X>
filter
public List<X> filter(List.Pred<X> p)
- Description copied from class:
List
- Filter out all the non-matching Elements
- Overrides:
filter
in class List<X>
foldl
public <Y> Y foldl(List.Fold<X,Y> f,
Y b)
- Description copied from class:
List
- Fold this List to a single Value (Left to Right)
- Overrides:
foldl
in class List<X>
foldr
public <Y> Y foldr(List.Fold<X,Y> f,
Y b)
- Description copied from class:
List
- Fold this List to a single Value (Right to Left)
- Overrides:
foldr
in class List<X>
map
public <Y> List<Y> map(List.Map<X,Y> m)
- Description copied from class:
List
- Apply a function to each Element of this List
- Overrides:
map
in class List<X>
add
public List<X> add(X t,
int i)
- Description copied from class:
List
- Add an Element to this list at the given index
- Overrides:
add
in class List<X>
remove
public List<X> remove(int i)
- Description copied from class:
List
- Remove an Element from this list at the given index
- Overrides:
remove
in class List<X>
insert
public List<X> insert(X a,
List.Comp<X> c)
- Description copied from class:
List
- Insert an Element into this SORTED list using the given Comparison
- Overrides:
insert
in class List<X>
sort
public List<X> sort(List.Comp<X> c)
- Description copied from class:
List
- Sort this List using the given Comparison
- Overrides:
sort
in class List<X>
zip
public <Y,Z> List<Z> zip(List.Zip<X,Y,Z> z,
List<Y> l)
- Description copied from class:
List
- Zip two lists (this, and 'l') into a single list, one element at a time
- Overrides:
zip
in class List<X>
replace
public List<X> replace(X t,
X s)
- Description copied from class:
List
- Replace the first occurrence of 't' with 's'
- Overrides:
replace
in class List<X>
replace
public List<X> replace(List.Pred<X> p,
X t)
- Description copied from class:
List
- Replace the first matching X with 's'
- Overrides:
replace
in class List<X>
replace
public List<X> replace(int t,
X s)
- Description copied from class:
List
- Replace the element at index 'i' with 's'
- Overrides:
replace
in class List<X>
replaceAll
public List<X> replaceAll(X t,
X s)
- Description copied from class:
List
- Replace all occurrences of 't' with 's'
- Overrides:
replaceAll
in class List<X>
replaceAll
public List<X> replaceAll(List.Pred<X> p,
X t)
- Description copied from class:
List
- Replace all matching Xs with 't'
- Overrides:
replaceAll
in class List<X>