I have collection of object as Collection basics = periodic.getGeneratedBasic();
When iterate over this collection and get every object and cast it, i can extract date of every object.
Now at this point i want to check out in this collection of object which one is the smallness and biggest date.
Does any one know how to do that?
Date max;
Date min;
for(Object o:basics){
Basic b = (Basic) o;
Date temp;
if(b.State=='U'){
basicAList.add(ba);
dateCollection.add(b.firstDateTime);
temp= ;
if(b.firstDateTime <)
}
}
Why not use Collections.sort() and then take the first/last entries? You can either use natural ordering, or specify your own Comparator.
Note this will sort the collection in-place. It won’t give you a new sorted collection.