@@ -270,26 +270,21 @@ public Storage storage() {
270270 * @param infos the blobs to get
271271 * @return an immutable list of {@code Blob} objects. If a blob does not exist or access to it has
272272 * been denied the corresponding item in the list is {@code null}.
273+ * @throws StorageException upon failure
273274 */
274275 public static List <Blob > get (final Storage storage , BlobInfo ... infos ) {
275276 checkNotNull (storage );
276277 checkNotNull (infos );
277- int length = infos .length ;
278- switch (length ) {
279- case 0 :
280- return Collections .emptyList ();
281- case 1 :
282- return Collections .singletonList (
283- new Blob (storage , storage .get (infos [0 ].bucket (), infos [0 ].name ())));
284- default :
285- return Collections .unmodifiableList (Lists .transform (storage .get (infos ),
286- new Function <BlobInfo , Blob >() {
287- @ Override
288- public Blob apply (BlobInfo f ) {
289- return f != null ? new Blob (storage , f ) : null ;
290- }
291- }));
278+ if (infos .length == 0 ) {
279+ return Collections .emptyList ();
292280 }
281+ return Collections .unmodifiableList (Lists .transform (storage .get (infos ),
282+ new Function <BlobInfo , Blob >() {
283+ @ Override
284+ public Blob apply (BlobInfo f ) {
285+ return f != null ? new Blob (storage , f ) : null ;
286+ }
287+ }));
293288 }
294289
295290 /**
@@ -300,25 +295,21 @@ public Blob apply(BlobInfo f) {
300295 * @param infos the blobs to update
301296 * @return an immutable list of {@code Blob} objects. If a blob does not exist or access to it has
302297 * been denied the corresponding item in the list is {@code null}.
298+ * @throws StorageException upon failure
303299 */
304300 public static List <Blob > update (final Storage storage , BlobInfo ... infos ) {
305301 checkNotNull (storage );
306302 checkNotNull (infos );
307- int length = infos .length ;
308- switch (length ) {
309- case 0 :
310- return Collections .emptyList ();
311- case 1 :
312- return Collections .singletonList (new Blob (storage , storage .update (infos [0 ])));
313- default :
314- return Collections .unmodifiableList (Lists .transform (storage .update (infos ),
315- new Function <BlobInfo , Blob >() {
316- @ Override
317- public Blob apply (BlobInfo f ) {
318- return f != null ? new Blob (storage , f ) : null ;
319- }
320- }));
303+ if (infos .length == 0 ) {
304+ return Collections .emptyList ();
321305 }
306+ return Collections .unmodifiableList (Lists .transform (storage .update (infos ),
307+ new Function <BlobInfo , Blob >() {
308+ @ Override
309+ public Blob apply (BlobInfo f ) {
310+ return f != null ? new Blob (storage , f ) : null ;
311+ }
312+ }));
322313 }
323314
324315 /**
@@ -330,18 +321,14 @@ public Blob apply(BlobInfo f) {
330321 * @return an immutable list of booleans. If a blob has been deleted the corresponding item in the
331322 * list is {@code true}. If deletion failed or access to the resource was denied the item is
332323 * {@code false}.
324+ * @throws StorageException upon failure
333325 */
334326 public static List <Boolean > delete (Storage storage , BlobInfo ... infos ) {
335327 checkNotNull (storage );
336328 checkNotNull (infos );
337- int length = infos .length ;
338- switch (length ) {
339- case 0 :
340- return Collections .emptyList ();
341- case 1 :
342- return Collections .singletonList (storage .delete (infos [0 ].bucket (), infos [0 ].name ()));
343- default :
344- return Collections .unmodifiableList (storage .delete (infos ));
329+ if (infos .length == 0 ) {
330+ return Collections .emptyList ();
345331 }
332+ return storage .delete (infos );
346333 }
347334}
0 commit comments