package com.ardverk.utils;

import java.io.Closeable;
import java.io.Flushable;
import java.io.IOException;
import java.util.Collection;

import org.slf4j.Logger;

import com.ardverk.logging.LoggerUtils;

public class IoUtils {

    private static final Logger LOG 
        = LoggerUtils.getLogger(IoUtils.class);
    
    private IoUtils() {}
    
    public static boolean close(Closeable closeable) {
        if (closeable != null) {
            try {
                closeable.close();
                return true;
            } catch (IOException err) {
                LOG.error("IOException", err);
            }
        }
        return false;
    }
    
    public static boolean closeAll(Closeable... closeables) {
        boolean success = false;
        if (closeables != null) {
            for (Closeable c : closeables) {
                success |= close(c);
            }
        }
        return success;
    }
    
    public static boolean closeAll(Collection<? extends Closeable> closeables) {
        boolean success = false;
        if (closeables != null) {
            for (Closeable c : closeables) {
                success |= close(c);
            }
        }
        return success;
    }
    
    public static boolean flush(Flushable flushable) {
        if (flushable != null) {
            try {
                flushable.flush();
                return true;
            } catch (IOException err) {
                LOG.error("IOException", err);
            }
        }
        return false;
    }
    
    public static boolean flushAll(Flushable... flushables) {
        boolean success = false;
        if (flushables != null) {
            for (Flushable c : flushables) {
                success |= flush(c);
            }
        }
        return success;
    }
    
    public static boolean flushAll(Collection<? extends Flushable> flushables) {
        boolean success = false;
        if (flushables != null) {
            for (Flushable c : flushables) {
                success |= flush(c);
            }
        }
        return success;
    }
}

@@ -104,37 +104,8 @@
 ion;
-%0Aimport java.util.Collection;
 %0A%0Aim
@@ -928,34 +928,32 @@
 an closeAll(
-Collection
+Iterable
 %3C? extends C
@@ -1807,18 +1807,16 @@
 All(
-Collection
+Iterable
 %3C? e

Use Iterable instead of Collection