// Taken directly from Taverna's local processor library
flatten(inputs, outputs, depth) {
        for (i = inputs.iterator(); i.hasNext();) {
            element = i.next();
                if (element instanceof Collection && depth > 0) {
                        flatten(element, outputs, depth - 1);
                } else {
                        outputs.add(element);
                }
        }
}

List outputlist = new ArrayList();
flatten(inputlist, outputlist, 1);
