00001: package clogs.util; 00002: 00003: 00004: class ListNil<A> extends List<A> 00005: { 00006: ListNil () 00007: { 00008: } 00009: 00010: 00011: public boolean isNil () 00012: { 00013: return true; 00014: } 00015: 00016: 00017: public int size () 00018: { 00019: return 0; 00020: } 00021: 00022: 00023: public A head () 00024: throws EmptyListException 00025: { 00026: throw new EmptyListException (); 00027: } 00028: 00029: 00030: public List<A> tail () 00031: throws EmptyListException 00032: { 00033: throw new EmptyListException (); 00034: } 00035: 00036: 00037: public List<A> concat (List<A> l) 00038: { 00039: return l; 00040: } 00041: 00042: 00043: public List<A> reverse () 00044: { 00045: return this; 00046: } 00047: 00048: 00049: public List<A> reverseAux (List<A> end) 00050: { 00051: return end; 00052: } 00053: 00054: 00055: public boolean equals (Object o) 00056: { 00057: return (o instanceof ListNil); 00058: } 00059: } 00060: