Use sorted set to order relative paths correctly

This commit is contained in:
Andrew Gaul 2015-01-20 14:04:41 -08:00
parent da3e7463fd
commit c770ffbeb0
2 changed files with 6 additions and 4 deletions

View File

@ -17,7 +17,7 @@
package org.jclouds.s3.blobstore.functions;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import javax.inject.Inject;
import javax.inject.Singleton;
@ -54,7 +54,8 @@ public class BucketToResourceList implements
}
public PageSet<? extends StorageMetadata> apply(ListBucketResponse from) {
Set<StorageMetadata> contents = Sets.<StorageMetadata> newHashSet(Iterables.transform(from,
// S3 lists keys in sorted order; use sorted set to order relative paths correctly
SortedSet<StorageMetadata> contents = Sets.<StorageMetadata> newTreeSet(Iterables.transform(from,
object2blobMd));
Map<String, StorageMetadata> nameToMd = Maps.uniqueIndex(contents, indexer);

View File

@ -17,7 +17,7 @@
package org.jclouds.azureblob.blobstore.functions;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import javax.inject.Inject;
import javax.inject.Singleton;
@ -55,7 +55,8 @@ public class ListBlobsResponseToResourceList implements
}
public PageSet<? extends StorageMetadata> apply(ListBlobsResponse from) {
Set<StorageMetadata> contents = Sets.<StorageMetadata> newHashSet(Iterables.transform(from,
// use sorted set to order relative paths correctly
SortedSet<StorageMetadata> contents = Sets.<StorageMetadata> newTreeSet(Iterables.transform(from,
object2blobMd));
Map<String, StorageMetadata> nameToMd = Maps.uniqueIndex(contents, indexer);