Search in sources :

Example 86 with Iterator

use of java.util.Iterator in project groovy-core by groovy.

the class GroovyResultSetExtension method add.

/**
     * Adds a new row to the result set
     *
     * @param values a map containing the mappings for column names and values
     * @throws java.sql.SQLException if something goes wrong
     * @see ResultSet#insertRow()
     * @see ResultSet#updateObject(java.lang.String, java.lang.Object)
     * @see ResultSet#moveToInsertRow()
     */
public void add(Map values) throws SQLException {
    getResultSet().moveToInsertRow();
    for (Iterator iter = values.entrySet().iterator(); iter.hasNext(); ) {
        Map.Entry entry = (Map.Entry) iter.next();
        getResultSet().updateObject(entry.getKey().toString(), entry.getValue());
    }
    getResultSet().insertRow();
}
Also used : Iterator(java.util.Iterator) Map(java.util.Map)

Example 87 with Iterator

use of java.util.Iterator in project groovy-core by groovy.

the class GroovyRowResult method getAt.

/**
     * Retrieve the value of the property by its index.
     * A negative index will count backwards from the last column.
     *
     * @param index is the number of the column to look at
     * @return the value of the property
     */
public Object getAt(int index) {
    try {
        // a negative index will count backwards from the last column.
        if (index < 0)
            index += result.size();
        Iterator it = result.values().iterator();
        int i = 0;
        Object obj = null;
        while ((obj == null) && (it.hasNext())) {
            if (i == index)
                obj = it.next();
            else
                it.next();
            i++;
        }
        return obj;
    } catch (Exception e) {
        throw new MissingPropertyException(Integer.toString(index), GroovyRowResult.class, e);
    }
}
Also used : Iterator(java.util.Iterator) MissingPropertyException(groovy.lang.MissingPropertyException) MissingPropertyException(groovy.lang.MissingPropertyException)

Example 88 with Iterator

use of java.util.Iterator in project groovy-core by groovy.

the class SwingGroovyMethods method buildRowData.

private static Object[] buildRowData(DefaultTableModel delegate, Object row) {
    int cols = delegate.getColumnCount();
    Object[] rowData = new Object[cols];
    int i = 0;
    for (Iterator it = DefaultGroovyMethods.iterator(row); it.hasNext() && i < cols; ) {
        rowData[i++] = it.next();
    }
    return rowData;
}
Also used : Iterator(java.util.Iterator)

Example 89 with Iterator

use of java.util.Iterator in project groovy-core by groovy.

the class TableLayoutRow method addCell.

/**
     * Adds a new cell to this row
     * @param tag the td element
     */
public void addCell(groovy.swing.impl.TableLayoutCell tag) {
    int gridx = 0;
    for (Iterator iter = cells.iterator(); iter.hasNext(); ) {
        groovy.swing.impl.TableLayoutCell cell = (groovy.swing.impl.TableLayoutCell) iter.next();
        gridx += cell.getColspan();
    }
    tag.getConstraints().gridx = gridx;
    cells.add(tag);
}
Also used : Iterator(java.util.Iterator)

Example 90 with Iterator

use of java.util.Iterator in project groovy-core by groovy.

the class Attributes method text.

public String text() {
    final StringBuilder sb = new StringBuilder();
    final Iterator iter = iterator();
    while (iter.hasNext()) {
        sb.append(iter.next());
    }
    return sb.toString();
}
Also used : Iterator(java.util.Iterator)

Aggregations

Iterator (java.util.Iterator)8930 ArrayList (java.util.ArrayList)2267 Set (java.util.Set)1895 HashMap (java.util.HashMap)1828 Map (java.util.Map)1714 List (java.util.List)1622 HashSet (java.util.HashSet)1602 Test (org.junit.Test)624 IOException (java.io.IOException)524 Collection (java.util.Collection)377 Region (org.apache.geode.cache.Region)240 SSOException (com.iplanet.sso.SSOException)227 File (java.io.File)216 LinkedList (java.util.LinkedList)213 TreeSet (java.util.TreeSet)191 LinkedHashMap (java.util.LinkedHashMap)181 Entry (java.util.Map.Entry)174 SMSException (com.sun.identity.sm.SMSException)169 ListIterator (java.util.ListIterator)146 TreeMap (java.util.TreeMap)145