@Test public void compareBlobObjects() { long currentMils = System.currentTimeMillis(); long dayInMils = 24 * 60 * 60 * 1000; BlobDetails bo1 = new BlobDetails("containerName", "blobName1", "eTag", new Date(currentMils - dayInMils * 1)); BlobDetails bo2 = new BlobDetails("containerName", "blobName2", "eTag", new Date(currentMils - dayInMils * 2)); assertEquals(1, comparator.compare(bo1, bo2)); assertEquals(0, comparator.compare(bo1, bo1)); assertEquals(-1, comparator.compare(bo2, bo1)); }
public int compare(BlobDetails b1, BlobDetails b2) { Date b1LastModifiedDate = b1.getLastModified(); Date b2LastModifiedDate = b2.getLastModified(); if (b1LastModifiedDate.after(b2LastModifiedDate)) { return 1; } else if (b1LastModifiedDate.before(b2LastModifiedDate)) { return -1; } else { return 0; } }
BlobLastModifiedDateComparator implements BlobDetailsComparator { public int compare(BlobDetails b1, BlobDetails b2) { Date b1LastModifiedDate = b1.getLastModified(); Date b2LastModifiedDate = b2.getLastModified(); if (b1LastModifiedDate.after(b2LastModifiedDate)) { return 1; } else if (b1LastModifiedDate.before(b2LastModifiedDate)) { return -1; } else { return 0; } } }
BlobLastModifiedDateComparator implements BlobDetailsComparator { public int compare(BlobDetails b1, BlobDetails b2) { Date b1LastModifiedDate = b1.getLastModified(); Date b2LastModifiedDate = b2.getLastModified(); if (b1LastModifiedDate.after(b2LastModifiedDate)) { return 1; } else if (b1LastModifiedDate.before(b2LastModifiedDate)) { return -1; } else { return 0; } }  }
BlobLastModifiedDateComparator implements BlobDetailsComparator { public int compare(BlobDetails b1, BlobDetails b2) { Date b1LastModifiedDate = b1.getLastModified(); Date b2LastModifiedDate = b2.getLastModified(); if (b1LastModifiedDate.after(b2LastModifiedDate)) { return 1; } else if (b1LastModifiedDate.before(b2LastModifiedDate)) { return -1; } else { return 0; } }  int compare(BlobDetails b1, BlobDetails b2); }
BlobLastModifiedDateComparator implements BlobDetailsComparator { public int compare(BlobDetails b1, BlobDetails b2) { Date b1LastModifiedDate = b1.getLastModified(); Date b2LastModifiedDate = b2.getLastModified(); if (b1LastModifiedDate.after(b2LastModifiedDate)) { return 1; } else if (b1LastModifiedDate.before(b2LastModifiedDate)) { return -1; } else { return 0; } }  int compare(BlobDetails b1, BlobDetails b2);  }