edu.rice.cs.plt.collect
Class ConsList.Empty<T>

java.lang.Object
  extended by edu.rice.cs.plt.iter.AbstractIterable<T>
      extended by edu.rice.cs.plt.collect.ConsList<T>
          extended by edu.rice.cs.plt.collect.ConsList.Empty<T>
All Implemented Interfaces:
SizedIterable<T>, Composite, java.io.Serializable, java.lang.Iterable<T>
Enclosing class:
ConsList<T>

public static class ConsList.Empty<T>
extends ConsList<T>

The empty variant of a ConsList. Instances are made available via make().

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.rice.cs.plt.collect.ConsList
ConsList.Empty<T>, ConsList.Nonempty<T>
 
Method Summary
<Ret> Ret
apply(ConsVisitor<? super T,? extends Ret> visitor)
          Invoke the forEmpty case of a visitor
 boolean isEmpty()
          Return true.
 java.util.Iterator<T> iterator()
          Return an empty iterator
static
<T> ConsList.Empty<T>
make()
          Creates an empty list.
 int size()
          Return 0
 int size(int bound)
          Return 0
 
Methods inherited from class edu.rice.cs.plt.collect.ConsList
append, compositeHeight, compositeSize, cons, empty, filter, first, hasFixedSize, isInfinite, isStatic, map, rest, reverse, singleton
 
Methods inherited from class edu.rice.cs.plt.iter.AbstractIterable
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

make

public static <T> ConsList.Empty<T> make()
Creates an empty list. The result is a singleton, cast (unsafe formally, but safe in practice) to the appropriate type


apply

public <Ret> Ret apply(ConsVisitor<? super T,? extends Ret> visitor)
Invoke the forEmpty case of a visitor

Specified by:
apply in class ConsList<T>

iterator

public java.util.Iterator<T> iterator()
Return an empty iterator

Specified by:
iterator in interface java.lang.Iterable<T>
Specified by:
iterator in class ConsList<T>

isEmpty

public boolean isEmpty()
Return true.

Specified by:
isEmpty in interface SizedIterable<T>
Specified by:
isEmpty in class ConsList<T>

size

public int size()
Return 0

Specified by:
size in interface SizedIterable<T>
Specified by:
size in class ConsList<T>

size

public int size(int bound)
Return 0

Specified by:
size in interface SizedIterable<T>
Specified by:
size in class ConsList<T>
Parameters:
bound - Maximum result. Assumed to be nonnegative.