]> source.dussan.org Git - jackcess.git/commitdiff
add method for creating Iterable given specific column names
authorJames Ahlborn <jtahlborn@yahoo.com>
Tue, 11 Mar 2008 17:28:37 +0000 (17:28 +0000)
committerJames Ahlborn <jtahlborn@yahoo.com>
Tue, 11 Mar 2008 17:28:37 +0000 (17:28 +0000)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@265 f203690c-595d-4dc9-a70b-905162fa7fd2

src/java/com/healthmarketscience/jackcess/Cursor.java

index 0b7f1b8088efea19a9e27f584864343465c44971..1e6ce52fc9afa4fe69251af6b46bac011b23ae73 100644 (file)
@@ -436,6 +436,22 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
     return iterator(null);
   }
   
+  /**
+   * Returns an Iterable whose iterator() method returns the result of a call
+   * to {@link #iterator(Collection<String>)}
+   * @throws IllegalStateException if an IOException is thrown by one of the
+   *         operations, the actual exception will be contained within
+   */
+  public Iterable<Map<String, Object>> iterable(
+      final Collection<String> columnNames)
+  {
+    return new Iterable<Map<String, Object>>() {
+      public Iterator<Map<String, Object>> iterator() {
+        return Cursor.this.iterator(columnNames);
+      }
+    };
+  }
+  
   /**
    * Calls <code>beforeFirst</code> on this table and returns an unmodifiable
    * Iterator which will iterate through all the rows of this table, returning