72 @SuppressWarnings("unchecked") |
72 @SuppressWarnings("unchecked") |
73 public static <A> List<A> nil() { |
73 public static <A> List<A> nil() { |
74 return (List<A>)EMPTY_LIST; |
74 return (List<A>)EMPTY_LIST; |
75 } |
75 } |
76 |
76 |
77 private static List<?> EMPTY_LIST = new List<Object>(null,null) { |
77 private static final List<?> EMPTY_LIST = new List<Object>(null,null) { |
78 public List<Object> setTail(List<Object> tail) { |
78 public List<Object> setTail(List<Object> tail) { |
79 throw new UnsupportedOperationException(); |
79 throw new UnsupportedOperationException(); |
80 } |
80 } |
81 public boolean isEmpty() { |
81 public boolean isEmpty() { |
82 return true; |
82 return true; |
389 for (Object o : list) |
389 for (Object o : list) |
390 klass.cast(o); |
390 klass.cast(o); |
391 return (List<T>)list; |
391 return (List<T>)list; |
392 } |
392 } |
393 |
393 |
394 private static Iterator<?> EMPTYITERATOR = new Iterator<Object>() { |
394 private static final Iterator<?> EMPTYITERATOR = new Iterator<Object>() { |
395 public boolean hasNext() { |
395 public boolean hasNext() { |
396 return false; |
396 return false; |
397 } |
397 } |
398 public Object next() { |
398 public Object next() { |
399 throw new java.util.NoSuchElementException(); |
399 throw new java.util.NoSuchElementException(); |