[PATCH] Use list() instead of iterator(). Why does this not work?

Wald Commits scm-commit at wald.intevation.org
Fri Aug 15 18:01:11 CEST 2014


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1408118466 -7200
# Node ID 7e55790da464499528c217a54fa1568ba55b69f2
# Parent  b834caf0a4f0e6a0ad1c1f3e4ce722c35c0fcbf4
Use list() instead of iterator(). Why does this not work?

diff -r b834caf0a4f0 -r 7e55790da464 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java	Mon Aug 11 18:34:21 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java	Fri Aug 15 18:01:06 2014 +0200
@@ -9,7 +9,7 @@
 
 import java.sql.Timestamp;
 import java.util.HashMap;
-import java.util.Iterator;
+import java.util.List;
 
 import net.sf.ehcache.Cache;
 import net.sf.ehcache.Element;
@@ -120,8 +120,9 @@
         HashMap<Integer, SedimentLoadData.Station> id2station
             = new HashMap<Integer, SedimentLoadData.Station>();
 
-        for (Iterator iter = sqlQuery.iterate(); iter.hasNext();) {
-            Object [] row = (Object [])iter.next();
+        List<Object[]> list = sqlQuery.list();
+
+        for (Object [] row: list) {
 
             Integer   sl_id            = (Integer)row[0];
             Integer   sl_kind          = (Integer)row[1];


More information about the Dive4Elements-commits mailing list