diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/jvm/clojure/lang/RT.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/jvm/clojure/lang/RT.java b/src/jvm/clojure/lang/RT.java index 10ab0016..b288f9cb 100644 --- a/src/jvm/clojure/lang/RT.java +++ b/src/jvm/clojure/lang/RT.java @@ -589,6 +589,16 @@ static public Object nth(Object coll, int n){ else if(coll instanceof Matcher) return ((Matcher) coll).group(n); + else if(coll instanceof Map.Entry) + { + Map.Entry e = (Map.Entry) coll; + if(n == 0) + return e.getKey(); + else if (n == 1) + return e.getValue(); + throw new IndexOutOfBoundsException(); + } + else if(coll instanceof Sequential) { ISeq seq = ((IPersistentCollection) coll).seq(); @@ -640,6 +650,15 @@ static public Object nth(Object coll, int n, Object notFound){ return m.group(n); return notFound; } + else if(coll instanceof Map.Entry) + { + Map.Entry e = (Map.Entry) coll; + if(n == 0) + return e.getKey(); + else if (n == 1) + return e.getValue(); + return notFound; + } else if(coll instanceof Sequential) { ISeq seq = ((IPersistentCollection) coll).seq(); |