Instead TreeSet I would able to achieve using HashSet.
Set<TestFoo> existingItems = readsFromDb(syncGuid);
Set<TestFoo> newItemsSet = new HashSet<newItems>;
if (!newItemsSet.equals(existingItems)) {
}
In TestFoo Pojo I have just override the equals and hash method