jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Noah Vihinen <nvihi...@maven.net>
Subject NodeIterator vs RowIterator
Date Fri, 04 May 2007 08:59:13 GMT
For best performance, should I prefer NodeIterator or RowIterator,  
given that I'm retrieving the set of all schema-defined properties on  
a node type?  Should the performance be exactly the same with the  
following two implementations?

Node Iterator implementation:
     NodeIterator nodes = result.getNodes();
     for(int i = 0; i < resultCount; i++)
     {
       StringBuffer rowStr = new StringBuffer();
       Node next = (Node)nodes.nextNode();
       PropertyIterator props = next.getProperties();
       while(props.hasNext())
         rowStr.append(props.nextProperty().getValue().getString() +  
" |");
     }

Row iterator implementation:
     RowIterator rows = result.getRows();
     for(int i = 0; i < resultCount; i++)
     {
       StringBuffer rowStr = new StringBuffer();
       Row next = (Row)rows.nextRow();
       Value[] props = next.getValues();
       for(Value val : props)
       {
         rowStr.append(val.getString() + " |");
       }
     }


Mime
View raw message