mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
fix for "no more elements available" exception
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4901 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
9e7c60f227
commit
9a9737a54e
|
@ -353,17 +353,27 @@ public class kelondroMapObjects extends kelondroObjects {
|
|||
|
||||
Iterator<String> keyIterator;
|
||||
boolean finish;
|
||||
HashMap<String, String> n;
|
||||
|
||||
public mapIterator(Iterator<String> 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<String, String> next() {
|
||||
HashMap<String, String> n1 = n;
|
||||
n = next0();
|
||||
return n1;
|
||||
}
|
||||
|
||||
private HashMap<String, String> next0() {
|
||||
if (finish) return null;
|
||||
if (keyIterator == null) return null;
|
||||
String nextKey;
|
||||
HashMap<String, String> 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() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user