Skip to content

Commit

Permalink
[doc] clarify lazy-eval of removeObjects (#811)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinSmile authored and nitisht committed Nov 13, 2019
1 parent 4a7779b commit 79f2eab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/src/main/java/io/minio/MinioClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -2985,7 +2985,8 @@ private List<DeleteError> removeObject(String bucketName, List<DeleteObject> obj


/**
* Removes multiple objects from a bucket.
* Removes multiple objects from a bucket. As objects removal are lazily executed, its required
* to iterate the returned Iterable.
*
* </p><b>Example:</b><br>
* <pre>{@code // Create object list for removal.
Expand All @@ -3000,6 +3001,8 @@ private List<DeleteError> removeObject(String bucketName, List<DeleteObject> obj
*
* @param bucketName Bucket name.
* @param objectNames List of Object names in the bucket.
*
* @return (lazy) Iterable of the Result DeleteErrors.
*/
public Iterable<Result<DeleteError>> removeObjects(final String bucketName, final Iterable<String> objectNames) {
return new Iterable<Result<DeleteError>>() {
Expand Down
1 change: 1 addition & 0 deletions examples/RemoveObjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public static void main(String[] args)
objectNames.add("my-objectname3");

// Remove object all objects 'objectNames' list from 'my-bucketname'.
// It is required to traverse over the returned Iterable for lazy evaluation.
for (Result<DeleteError> errorResult: minioClient.removeObjects("my-bucketname", objectNames)) {
DeleteError error = errorResult.get();
System.out.println("Failed to remove '" + error.objectName() + "'. Error:" + error.message());
Expand Down

0 comments on commit 79f2eab

Please sign in to comment.