MCPcopy Index your code
hub / github.com/clojure/clojure / PersistentList

Class PersistentList

src/jvm/clojure/lang/PersistentList.java:16–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14import java.util.*;
15
16public class PersistentList extends ASeq implements IPersistentList, IReduce, List, Counted {
17
18private static final long serialVersionUID = -8833289659955219995L;
19
20private final Object _first;
21private final IPersistentList _rest;
22private final int _count;
23
24static public class Primordial extends RestFn{
25 final public int getRequiredArity(){
26 return 0;
27 }
28
29 final protected Object doInvoke(Object args) {
30 if(args instanceof ArraySeq)
31 {
32 Object[] argsarray = ((ArraySeq) args).array;
33 IPersistentList ret = EMPTY;
34 for(int i = argsarray.length - 1; i >= ((ArraySeq)args).i; --i)
35 ret = (IPersistentList) ret.cons(argsarray[i]);
36 return ret;
37 }
38 LinkedList list = new LinkedList();
39 for(ISeq s = RT.seq(args); s != null; s = s.next())
40 list.add(s.first());
41 return create(list);
42 }
43
44 static public Object invokeStatic(ISeq args) {
45 if(args instanceof ArraySeq)
46 {
47 Object[] argsarray = ((ArraySeq) args).array;
48 IPersistentList ret = EMPTY;
49 for(int i = argsarray.length - 1; i >= 0; --i)
50 ret = (IPersistentList) ret.cons(argsarray[i]);
51 return ret;
52 }
53 LinkedList list = new LinkedList();
54 for(ISeq s = RT.seq(args); s != null; s = s.next())
55 list.add(s.first());
56 return create(list);
57 }
58
59 public IObj withMeta(IPersistentMap meta){
60 throw new UnsupportedOperationException();
61 }
62
63 public IPersistentMap meta(){
64 return null;
65 }
66}
67
68public static IFn creator = new Primordial();
69
70final public static EmptyList EMPTY = new EmptyList(null);
71
72public PersistentList(Object first){
73 this._first = first;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected