DOReader r =
m_manager.getReader(Server.GLOBAL_CHOICE, context, pid);
Date[] versionDates = r.getDatastreamVersions(datastreamID);
Datastream[] versions = new Datastream[versionDates.length];
for (int i = 0; i < versionDates.length; i++) {
versions[i] = r.GetDatastream(datastreamID, versionDates[i]);
}
// sort, ascending
Arrays.sort(versions, new DatastreamDateComparator());
// reverse it (make it descend, so most recent date is element 0)
Datastream[] out = new Datastream[versions.length];