Friday, 15 August 2014

java - Return sublist of a List of object array -


I'm getting results after querying for the database

  VendorName | IncidentID | IncidentStatus | Event day ------------------------------------------------ - ------ XYZ | 100 | Open | 02-Jun-2011 ABC 101 | Off | 03-Jun-2011 MNP | 102 | Open | 01-Jun-2011 LPQ | 103 | Open | 01-APR-2011   

I'm repeating the list using the following snippet of code

  Iterator iter = resultList.iterator (); While (iter.hasNext ()) {object [] result = (object []) iter.next (); System.out.println ("vendor name -> gt; + result [0]); }   

While repeating the list, I want to return only the closed event line How to do this?

I think, this can be done by defining a new list and by adding one object by one, but is there a better way?

Why are you filtering result sets? It seems kinda unnecessary why not just add "IncidentStatus == Off" in your inquiry?

No comments:

Post a Comment