boon/src/main/java/org/boon/core/Conversions.java
public static Object unifyListOrArray(Object o, List list) {

        if (o==null) {
            return null;
        }

        boolean isArray = o.getClass().isArray();

        if (list == null && !isArray && !(o instanceof Iterable)) {
            return o;
        }

        if (list == null) {
            list = new LinkedList();
        }


        if (isArray) {
            int length = Array.getLength( o );

            for (int index = 0; index < length; index++) {

                Object o1 = Array.get(o, index);
                if (o1 instanceof Iterable || o.getClass().isArray()) {
                    unifyListOrArray(o1, list);
                } else {
                    list.add(o1);
                }
            }
        } else if (o instanceof Collection) {

            Collection i = ((Collection) o);



            for (Object item : i) {

                if (item instanceof Iterable || o.getClass().isArray()) {
                    unifyListOrArray(item, list);
                } else {
                    list.add(item);
                }

            }


        } else {

            list.add(o);
        }

        return list;


    }
public static Object unifyListOrArray(Object o, List list) {

        if (o==null) {
            return null;
        }

        boolean isArray = o.getClass().isArray();

        if (list == null && !isArray && !(o instanceof Iterable)) {
            return o;
        }

        if (list == null) {
            list = new LinkedList();
        }


        if (isArray) {
            int length = Array.getLength( o );

            for (int index = 0; index < length; index++) {

                Object o1 = Array.get(o, index);
                if (o1 instanceof Iterable || o.getClass().isArray()) {
                    unifyListOrArray(o1, list);
                } else {
                    list.add(o1);
                }
            }
        } else if (o instanceof Collection) {

            Collection i = ((Collection) o);



            for (Object item : i) {

                if (item instanceof Iterable || o.getClass().isArray()) {
                    unifyListOrArray(item, list);
                } else {
                    list.add(item);
                }

            }


        } else {

            list.add(o);
        }

        return list;


    }
This flattens a list.
@param o object that might be a list
@param list list to add o to or all of o's items to.
@return an object or a list