Mercurial > lasercutter
view src/clojure/lang/SeqIterator.java @ 10:ef7dbbd6452c
added clojure source goodness
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 21 Aug 2010 06:25:44 -0400 |
parents | |
children |
line wrap: on
line source
1 /**2 * Copyright (c) Rich Hickey. All rights reserved.3 * The use and distribution terms for this software are covered by the4 * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)5 * which can be found in the file epl-v10.html at the root of this distribution.6 * By using this software in any fashion, you are agreeing to be bound by7 * the terms of this license.8 * You must not remove this notice, or any other, from this software.9 **/11 /* rich Jun 19, 2007 */13 package clojure.lang;15 import java.util.Iterator;16 import java.util.NoSuchElementException;18 public class SeqIterator implements Iterator{20 ISeq seq;22 public SeqIterator(ISeq seq){23 this.seq = seq;24 }26 public boolean hasNext(){27 return seq != null;28 }30 public Object next() throws NoSuchElementException {31 if(seq == null)32 throw new NoSuchElementException();33 Object ret = RT.first(seq);34 seq = RT.next(seq);35 return ret;36 }38 public void remove(){39 throw new UnsupportedOperationException();40 }41 }