From 9a9737a54e29a61c4e53e04c618015605a648f44 Mon Sep 17 00:00:00 2001 From: orbiter Date: Sat, 7 Jun 2008 22:07:25 +0000 Subject: [PATCH] fix for "no more elements available" exception git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4901 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/kelondro/kelondroMapObjects.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source/de/anomic/kelondro/kelondroMapObjects.java b/source/de/anomic/kelondro/kelondroMapObjects.java index bb1dc1bcf..339776b17 100644 --- a/source/de/anomic/kelondro/kelondroMapObjects.java +++ b/source/de/anomic/kelondro/kelondroMapObjects.java @@ -353,17 +353,27 @@ public class kelondroMapObjects extends kelondroObjects { Iterator keyIterator; boolean finish; + HashMap n; public mapIterator(Iterator keyIterator) { this.keyIterator = keyIterator; this.finish = false; + this.n = next0(); } public boolean hasNext() { - return (!(finish)) && (keyIterator != null) && (keyIterator.hasNext()); + return this.n != null; } public HashMap next() { + HashMap n1 = n; + n = next0(); + return n1; + } + + private HashMap next0() { + if (finish) return null; + if (keyIterator == null) return null; String nextKey; HashMap map; while (keyIterator.hasNext()) { @@ -377,7 +387,7 @@ public class kelondroMapObjects extends kelondroObjects { map.put("key", nextKey); return map; } - throw new kelondroException("no more elements available"); + return null; } public void remove() {