Example usage for org.apache.commons.collections OrderedMap keySet

List of usage examples for org.apache.commons.collections OrderedMap keySet

Introduction

In this page you can find the example usage for org.apache.commons.collections OrderedMap keySet.

Prototype

Set<K> keySet();

Source Link

Document

Returns a Set view of the keys contained in this map.

Usage

From source file:org.pentaho.platform.plugin.services.connections.xquery.XQResultSet.java

public Object[] next() {
    if (peekRow != null) {
        Object[] row = peekRow;/*from w w  w. ja  va2  s . c o  m*/
        peekRow = null;
        return row;
    }

    // Create a map of the headers and assign empty string to them
    OrderedMap resultList = new ListOrderedMap();
    for (int i = 0; i < metaData.getColumnCount(); i++) {
        resultList.put(metaData.getColumnHeaders()[0][i], XQResultSet.EMPTY_STR);
    }
    // Get the next row of data
    if (iter.hasNext()) {
        Object o = iter.next();
        decodeNode(o, resultList);
    }
    // get the values
    Object[] currentRow = new Object[resultList.size()];
    Iterator keyIter = resultList.keySet().iterator();
    int i = 0;
    while (keyIter.hasNext()) {
        currentRow[i] = resultList.get(keyIter.next());
        i++;
    }
    // if all the values are the empty string then we're done.
    boolean done = true;
    for (Object element : currentRow) {
        if (!("".equals(element))) { //$NON-NLS-1$
            done = false;
        }
    }
    if (done) {
        return null;
    }
    return currentRow;
}