summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2006-08-04 23:16:49 +0000
committerRich Hickey <richhickey@gmail.com>2006-08-04 23:16:49 +0000
commit7e9b97b213b0214238c244eff9389554adcba54e (patch)
tree8e7a1565426f6a0805723dc935cee96ab6e3012a /src
parentae23e1e284833c61924cc09f4053ded4cc96cc44 (diff)
got rid of identity maps
Diffstat (limited to 'src')
-rw-r--r--src/cli/runtime/PersistentArrayIdentityMap.cs50
-rw-r--r--src/cli/runtime/PersistentHashtableIdentityMap.cs111
-rw-r--r--src/cli/runtime/PersistentListIdentityMap.cs384
-rw-r--r--src/jvm/clojure/lang/PersistentArrayIdentityMap.java51
-rw-r--r--src/jvm/clojure/lang/PersistentHashtableIdentityMap.java102
-rw-r--r--src/jvm/clojure/lang/PersistentListIdentityMap.java324
6 files changed, 0 insertions, 1022 deletions
diff --git a/src/cli/runtime/PersistentArrayIdentityMap.cs b/src/cli/runtime/PersistentArrayIdentityMap.cs
deleted file mode 100644
index 93fe2a15..00000000
--- a/src/cli/runtime/PersistentArrayIdentityMap.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-using System;
-
-namespace clojure.lang
-{
-/**
- * ArrayMap using identity (==) comparison instead of equals
- */
-public class PersistentArrayIdentityMap : PersistentArrayMap {
-
-new public static PersistentArrayIdentityMap EMPTY = new PersistentArrayIdentityMap();
-
-override public IPersistentMap empty() {
- return EMPTY;
-}
-
-PersistentArrayIdentityMap() {
-}
-
-override internal PersistentArrayMap create(params Object[] init)
- {
- PersistentArrayIdentityMap ret = new PersistentArrayIdentityMap(init);
- ret._meta = _meta;
- return ret;
- }
-
-override internal IPersistentMap createHT(Object[] init){
- PersistentHashtableIdentityMap ret = new PersistentHashtableIdentityMap(init);
- ret._meta = _meta;
- return ret;
-}
-
-public PersistentArrayIdentityMap(params Object[] init) :base(init) {
-}
-
-internal override bool equalKey(Object k1, Object k2) {
- return k1 == k2;
-}
-}
-
-} \ No newline at end of file
diff --git a/src/cli/runtime/PersistentHashtableIdentityMap.cs b/src/cli/runtime/PersistentHashtableIdentityMap.cs
deleted file mode 100644
index 5ea01457..00000000
--- a/src/cli/runtime/PersistentHashtableIdentityMap.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-using System;
-using System.Collections;
-
-namespace clojure.lang
- {
-
-public class PersistentHashtableIdentityMap : PersistentHashtableMap {
-
-public PersistentHashtableIdentityMap(int initialCapacity) : base(initialCapacity) {
-}
-
-public PersistentHashtableIdentityMap(Object[] init) : base(init){
-}
-
-PersistentHashtableIdentityMap(int count, PersistentArray array) : base(count, array) {
-}
-
-PersistentHashtableIdentityMap(int i, PersistentArray newArray, int growAtCount):base(i,newArray,growAtCount){
-}
-
-
-override public IEnumerator GetEnumerator()
- {
- return new Iter2(array);
- }
-
-
-internal class Iter2 : IEnumerator
- {
- PersistentArray buckets;
- int b;
- Object e;
-
- internal Iter2(PersistentArray buckets)
- {
- this.buckets = buckets;
- this.b = -1;
- }
-
- private void nextBucket()
- {
- e = null;
- for (b = b + 1; b < buckets.length(); b++)
- {
- Object a = buckets.get(b);
- if (a != null && a != PersistentListIdentityMap.EMPTY)
- {
- e = a;
- break;
- }
- }
- }
-
- #region IEnumerator Members
-
- public object Current
- {
- get { return e; }
- }
-
- public bool MoveNext()
- {
- if (e == null || (e = ((PersistentListIdentityMap)e).next()) == PersistentListIdentityMap.EMPTY)
- nextBucket();
- return e != null;
- }
-
- public void Reset()
- {
- throw new Exception("The method or operation is not implemented.");
- }
-
- #endregion
- }
-
-
-internal override IPersistentMap create(int capacity) {
- PersistentHashtableIdentityMap ret = new PersistentHashtableIdentityMap(capacity);
- ret._meta = _meta;
- return ret;
- }
-
-internal override IPersistentMap create(int count, PersistentArray array) {
- PersistentHashtableIdentityMap ret = new PersistentHashtableIdentityMap(count, array);
- ret._meta = _meta;
- return ret;
- }
-
-internal override IPersistentMap create(int i, PersistentArray newArray, int growAtCount){
- PersistentHashtableIdentityMap ret = new PersistentHashtableIdentityMap(i, newArray, growAtCount);
- ret._meta = _meta;
- return ret;
- }
-
-internal override IPersistentMap createListMap(Object key, Object val){
- return PersistentListIdentityMap.create(key,val);
-}
-
-}
-
-}
diff --git a/src/cli/runtime/PersistentListIdentityMap.cs b/src/cli/runtime/PersistentListIdentityMap.cs
deleted file mode 100644
index 6a84c000..00000000
--- a/src/cli/runtime/PersistentListIdentityMap.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-/* rich Jun 6, 2006 */
-
-using System;
-using System.Collections;
-
-namespace clojure.lang
- {
- /**
- * Implementation of persistent map on a linked list
- * Uses identity (==) comparison, vs equals() of PersistentListMap
-
- * Note that instances of this class are constant values
- * i.e. add/remove etc return new values
- *
- * Lookups/changes are linear, so only appropriate for _very_small_ maps
- * PersistentArrayMap is generally faster, but this class avoids the double allocation,
- * and so is better/faster as a bucket for hash tables
- *
- * null keys and values are ok, but you won't be able to distinguish a null value via get - use contains/find
- *
- * code duplication here is kind of gross, but most efficient
- */
-
- public class PersistentListIdentityMap : Obj, IPersistentMap, IMapEntry, ISeq, IPersistentCollection
- {
-
- static public PersistentListIdentityMap EMPTY = new PersistentListIdentityMap();
-
- static public PersistentListIdentityMap create(Object key, Object val)
- {
- return new Tail(key, val,null);
- }
-
- public override Obj withMeta(IPersistentMap meta)
- {
- Obj ret = (Obj)MemberwiseClone();
- ret._meta = meta;
- return ret;
- }
-
- public virtual Object key()
- {
- return null;
- }
-
- public virtual Object val()
- {
- return null;
- }
-
- internal virtual PersistentListIdentityMap next()
- {
- return this;
- }
-
- public virtual int count()
- {
- return 0;
- }
-
- public virtual bool contains(Object key)
- {
- return false;
- }
-
- public virtual IMapEntry find(Object key)
- {
- return null;
- }
-
- public virtual IPersistentMap add(Object key, Object val)
- {
- return put(key, val);
- }
-
- public virtual IPersistentMap put(Object key, Object val)
- {
- return new Tail(key, val, _meta);
- }
-
- public virtual IPersistentMap remove(Object key)
- {
- return this;
- }
-
- public virtual Object get(Object key)
- {
- return null;
- }
-
- public virtual int capacity()
- {
- return 0;
- }
-
- virtual public Object first()
- {
- return null;
- }
-
- virtual public ISeq rest()
- {
- return null;
- }
-
- virtual public ISeq seq()
- {
- return null;
- }
-
- internal class Iter : IEnumerator
- {
- PersistentListIdentityMap e;
- bool first = true;
-
- internal Iter(PersistentListIdentityMap e)
- {
- this.e = e;
- }
-
- #region IEnumerator Members
-
- public object Current
- {
- get { return e; }
- }
-
- public bool MoveNext()
- {
- if (first)
- first = false;
- else
- e = e.next();
- return e.count() > 0;
- }
-
- public void Reset()
- {
- throw new Exception("The method or operation is not implemented.");
- }
-
- #endregion
- }
-
- public IEnumerator GetEnumerator()
- {
- return new Iter(this);
- }
-
- internal class Tail : PersistentListIdentityMap
- {
- readonly Object _key;
- readonly Object _val;
-
- internal Tail(Object key, Object val, IPersistentMap meta)
- {
- this._key = key;
- this._val = val;
- this._meta = meta;
- }
-
- override internal PersistentListIdentityMap next()
- {
- return EMPTY;
- }
-
- override public int count()
- {
- return 1;
- }
-
- override public Object get(Object key)
- {
- if (key == _key)
- return _val;
- return null;
- }
-
- override public int capacity()
- {
- return 1;
- }
-
- override public Object key()
- {
- return _key;
- }
-
- override public Object val()
- {
- return _val;
- }
-
- override public bool contains(Object key)
- {
- return (key == _key);
- }
-
- override public IMapEntry find(Object key)
- {
- if ((key == _key))
- return this;
- return null;
- }
-
- override public IPersistentMap add(Object key, Object val)
- {
- if ((key == _key))
- {
- throw new Exception("Key already present");
- }
- return new Link(key, val, this, _meta);
- }
-
- override public IPersistentMap put(Object key, Object val)
- {
- if ((key == _key)) //replace
- {
- if (val == _val)
- return this;
- return new Tail(key, val, _meta);
- }
- return new Link(key, val, this, _meta);
- }
-
- override public IPersistentMap remove(Object key)
- {
- if ((key == _key))
- {
- if (_meta == null)
- return EMPTY;
- return (IPersistentMap)EMPTY.withMeta(_meta);
- }
- return this;
- }
-
- override public Object first()
- {
- return this;
- }
-
- override public ISeq rest()
- {
- return null;
- }
-
- override public ISeq seq()
- {
- return this;
- }
- }
-
- internal class Link : PersistentListIdentityMap
- {
- readonly Object _key;
- readonly Object _val;
- readonly PersistentListIdentityMap _rest;
-
- internal Link(Object key, Object val, PersistentListIdentityMap next, IPersistentMap meta)
- {
- this._key = key;
- this._val = val;
- this._rest = next;
- this._meta = meta;
- }
-
- override public Object key()
- {
- return _key;
- }
-
- override public Object val()
- {
- return _val;
- }
-
- override internal PersistentListIdentityMap next()
- {
- return _rest;
- }
-
- override public int count()
- {
- return 1 + _rest.count();
- }
-
- override public bool contains(Object key)
- {
- return find(key) != null;
- }
-
- override public IMapEntry find(Object key)
- {
- if ((key == _key))
- return this;
- return _rest.find(key);
- }
-
- override public IPersistentMap add(Object key, Object val)
- {
- IMapEntry e = find(key);
- if (e != null)
- {
- throw new Exception("Key already present");
- }
- return new Link(key, val, this, _meta);
- }
-
- override public IPersistentMap put(Object key, Object val)
- {
- IMapEntry e = find(key);
- if (e != null)
- {
- if (e.val() == val)
- return this;
- return create(_key, _val, remove(key));
- }
- return new Link(key, val, this, _meta);
- }
-
- override public IPersistentMap remove(Object key)
- {
- if ((key == _key))
- {
- if (_rest._meta == _meta)
- return _rest;
- return (IPersistentMap)_rest.withMeta(_meta);
- }
- PersistentListIdentityMap r = (PersistentListIdentityMap)_rest.remove(key);
- if (r == _rest) //not there
- return this;
- return create(_key, _val, r);
- }
-
- override public Object get(Object key)
- {
- IMapEntry e = find(key);
- if (e != null)
- return e.val();
- return null;
- }
-
- override public int capacity()
- {
- return count();
- }
-
- override public Object first()
- {
- return this;
- }
-
- override public ISeq rest()
- {
- return _rest;
- }
-
- override public ISeq seq()
- {
- return this;
- }
-
- PersistentListIdentityMap create(Object k, Object v, IPersistentMap r)
- {
- if (r == EMPTY)
- return new Tail(k, v, _meta);
- return new Link(k, v, (PersistentListIdentityMap)r, _meta);
- }
-
- }
-
- }
-
- }
diff --git a/src/jvm/clojure/lang/PersistentArrayIdentityMap.java b/src/jvm/clojure/lang/PersistentArrayIdentityMap.java
deleted file mode 100644
index a66c0482..00000000
--- a/src/jvm/clojure/lang/PersistentArrayIdentityMap.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-package clojure.lang;
-
-/**
- * ArrayMap using identity (==) comparison instead of equals
- */
-public class PersistentArrayIdentityMap extends PersistentArrayMap {
-
-public static PersistentArrayIdentityMap EMPTY = new PersistentArrayIdentityMap();
-
-
-private PersistentArrayIdentityMap() {
-}
-
-PersistentArrayMap create(Object... init){
- PersistentArrayIdentityMap ret = new PersistentArrayIdentityMap(init);
- ret._meta = _meta;
- return ret;
-}
-
-IPersistentMap createHT(Object[] init){
- PersistentHashtableIdentityMap ret = new PersistentHashtableIdentityMap(init);
- ret._meta = _meta;
- return ret;
-}
-
-IPersistentMap empty() {
- if(_meta == null)
- return EMPTY;
- PersistentArrayIdentityMap ret = new PersistentArrayIdentityMap();
- ret._meta = _meta;
- return ret;
-}
-
-public PersistentArrayIdentityMap(Object... init) {
- super(init);
-}
-
-boolean equalKey(Object k1, Object k2) {
- return k1 == k2;
-}
-}
diff --git a/src/jvm/clojure/lang/PersistentHashtableIdentityMap.java b/src/jvm/clojure/lang/PersistentHashtableIdentityMap.java
deleted file mode 100644
index 1f1a50c0..00000000
--- a/src/jvm/clojure/lang/PersistentHashtableIdentityMap.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-package clojure.lang;
-
-import java.util.Iterator;
-
-public class PersistentHashtableIdentityMap extends PersistentHashtableMap {
-
-public PersistentHashtableIdentityMap(int initialCapacity) {
- super(initialCapacity);
-}
-
-public PersistentHashtableIdentityMap(Object[] init) {
- super(init);
-}
-
-PersistentHashtableIdentityMap(int count, PersistentArray array) {
- super(count, array);
-}
-
-PersistentHashtableIdentityMap(int i, PersistentArray newArray, int growAtCount) {
- super(i, newArray, growAtCount);
-}
-
-
-public Iterator<IMapEntry> iterator() {
- return new Iter(array);
-}
-
-
-static class Iter implements Iterator{
- PersistentArray buckets;
- int b;
- PersistentListIdentityMap e;
-
- Iter(PersistentArray buckets){
- this.buckets = buckets;
- this.b = -1;
- nextBucket();
- }
-
- private void nextBucket() {
- e = null;
- for(b = b+1;b<buckets.length();b++)
- {
- PersistentListIdentityMap a = (PersistentListIdentityMap) buckets.get(b);
- if(a != null && a != PersistentListIdentityMap.EMPTY)
- {
- e = a;
- break;
- }
- }
- }
-
- public boolean hasNext() {
- return e != null;
- }
-
- public Object next() {
- PersistentListIdentityMap ret = e;
- e = e.next();
- if(e == PersistentListIdentityMap.EMPTY)
- nextBucket();
- return ret;
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
-}
-
-IPersistentMap create(int capacity) {
- PersistentHashtableIdentityMap ret = new PersistentHashtableIdentityMap(capacity);
- ret._meta = _meta;
- return ret;
-}
-
-IPersistentMap create(int count, PersistentArray array) {
- PersistentHashtableIdentityMap ret = new PersistentHashtableIdentityMap(count, array);
- ret._meta = _meta;
- return ret;
-}
-
-IPersistentMap create(int i, PersistentArray newArray, int growAtCount){
- PersistentHashtableIdentityMap ret = new PersistentHashtableIdentityMap(i, newArray, growAtCount);
- ret._meta = _meta;
- return ret;
-}
-
-IPersistentMap createListMap(Object key, Object val){
- return PersistentListIdentityMap.create(key,val);
-}
-
-}
diff --git a/src/jvm/clojure/lang/PersistentListIdentityMap.java b/src/jvm/clojure/lang/PersistentListIdentityMap.java
deleted file mode 100644
index efc1f38a..00000000
--- a/src/jvm/clojure/lang/PersistentListIdentityMap.java
+++ /dev/null
@@ -1,324 +0,0 @@
-/**
- * Copyright (c) Rich Hickey. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- * which can be found in the file CPL.TXT at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-package clojure.lang;
-
-import java.util.Iterator;
-
-/**
- * Implementation of persistent map on a linked list
- * Uses identity (==) comparison, vs equals() of PersistentListMap
-
- * Note that instances of this class are constant values
- * i.e. add/remove etc return new values
- *
- * Lookups/changes are linear, so only appropriate for _very_small_ maps
- * PersistentArrayMap is generally faster, but this class avoids the double allocation,
- * and so is better/faster as a bucket for hash tables
- *
- * null keys and values are ok, but you won't be able to distinguish a null value via get - use contains/find
- *
- * code duplication here is kind of gross, but most efficient
- */
-
-public class PersistentListIdentityMap extends Obj implements IPersistentMap, IMapEntry, ISeq, IPersistentCollection,Cloneable
-{
-
-static public PersistentListIdentityMap EMPTY = new PersistentListIdentityMap();
-
-static public PersistentListIdentityMap create(Object key, Object val){
- return new Tail(key, val,null);
-}
-
-public Obj withMeta(IPersistentMap meta) {
- try{
- Obj ret = (Obj) clone();
- ret._meta = meta;
- return ret;
- }
- catch(CloneNotSupportedException ignore)
- {
- return null;
- }
-}
-
-public Object key(){
- return null;
-}
-
-public Object val(){
- return null;
-}
-
-PersistentListIdentityMap next(){
- return this;
- }
-
-public int count(){
- return 0;
-}
-
-public boolean contains(Object key){
- return false;
-}
-
-public IMapEntry find(Object key){
- return null;
-}
-
-public IPersistentMap add(Object key, Object val) throws Exception {
- return put(key, val);
-}
-
-public PersistentListIdentityMap put(Object key, Object val){
- return new Tail(key, val,_meta);
-}
-
-public PersistentListIdentityMap remove(Object key){
- return this;
-}
-
-public Object get(Object key){
- return null;
-}
-
-public int capacity(){
- return 0;
-}
-
-public Object first() {
- return null;
-}
-
-public ISeq rest() {
- return null;
-}
-
-public ISeq seq() {
- return null;
-}
-
-
-static class Iter implements Iterator{
- PersistentListIdentityMap e;
-
- Iter(PersistentListIdentityMap e)
- {
- this.e = e;
- }
-
- public boolean hasNext(){
- return e.count() > 0;
- }
-
- public Object next(){
- PersistentListIdentityMap ret = e;
- e = e.next();
- return ret;
- }
-
- public void remove(){
- throw new UnsupportedOperationException();
- }
-}
-
-public Iterator iterator(){
- return new Iter(this);
-}
-
-static class Tail extends PersistentListIdentityMap {
- final Object _key;
- final Object _val;
-
- Tail(Object key,Object val,IPersistentMap meta){
- this._key = key;
- this._val = val;
- this._meta = meta;
- }
-
- PersistentListIdentityMap next(){
- return EMPTY;
- }
-
- public int count(){
- return 1;
- }
-
- public Object get(Object key){
- if(key ==_key)
- return _val;
- return null;
- }
-
- public int capacity(){
- return 1;
- }
-
- public Object key(){
- return _key;
- }
-
- public Object val(){
- return _val;
- }
-
- public boolean contains(Object key){
- return key ==_key;
- }
-
- public IMapEntry find(Object key){
- if(key ==_key)
- return this;
- return null;
- }
-
- public PersistentListIdentityMap add(Object key, Object val) throws Exception{
- if(key == _key)
- {
- throw new Exception("Key already present");
- }
- return new Link(key,val,this,_meta);
- }
-
- public PersistentListIdentityMap put(Object key, Object val){
- if(key == _key) //replace
- {
- if(val == _val)
- return this;
- return new Tail(key,val,_meta);
- }
- return new Link(key,val,this,_meta);
- }
-
- public PersistentListIdentityMap remove(Object key){
- if(key == _key)
- {
- if(_meta == null)
- return EMPTY;
- return (PersistentListIdentityMap) EMPTY.withMeta(_meta);
- } return this;
- }
-
- public Object first() {
- return this;
- }
-
- public ISeq rest() {
- return null;
- }
-
- public ISeq seq() {
- return this;
- }
-}
-
-static class Link extends PersistentListIdentityMap {
- final Object _key;
- final Object _val;
- final PersistentListIdentityMap _rest;
-
- Link(Object key,Object val,PersistentListIdentityMap next,IPersistentMap meta){
- this._key = key;
- this._val = val;
- this._rest = next;
- this._meta = meta;
- }
-
- public Object key(){
- return _key;
- }
-
- public Object val(){
- return _val;
- }
-
- PersistentListIdentityMap next(){
- return _rest;
- }
-
- public int count(){
- return 1 + _rest.count();
- }
-
- public boolean contains(Object key){
- return find(key) != null;
- }
-
- public IMapEntry find(Object key){
- if(key ==_key)
- return this;
- return _rest.find(key);
- }
-
- public PersistentListIdentityMap add(Object key, Object val) throws Exception{
- IMapEntry e = find(key);
- if(e != null)
- {
- throw new Exception("Key already present");
- }
- return new Link(key,val,this,_meta);
- }
-
- public PersistentListIdentityMap put(Object key, Object val){
- IMapEntry e = find(key);
- if(e != null)
- {
- if(e.val() == val)
- return this;
- return create(_key,_val,remove(key));
- }
- return new Link(key,val,this,_meta);
- }
-
- public PersistentListIdentityMap remove(Object key){
- if(key == _key)
- {
- if(_rest._meta == _meta)
- return _rest;
- return (PersistentListIdentityMap) _rest.withMeta(_meta);
- }
- PersistentListIdentityMap r = _rest.remove(key);
- if(r == _rest) //not there
- return this;
- return create(_key,_val,r);
- }
-
- public Object get(Object key){
- IMapEntry e = find(key);
- if(e != null)
- return e.val();
- return null;
- }
-
- public int capacity(){
- return count();
- }
-
- public Object first() {
- return this;
- }
-
- public ISeq rest() {
- return _rest;
- }
-
- public ISeq seq() {
- return this;
- }
-
- PersistentListIdentityMap create(Object k,Object v,PersistentListIdentityMap r){
- if(r.count() == 0)
- return new Tail(k,v,_meta);
- return new Link(k, v, r,_meta);
- }
-
-}
-
-}