// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class LotsOfLists {
    public static interface Execute
    {
         public Collection<Integer> exec();
    } 
    public static class ExecuteImpl implements Execute {
        private List<Integer> data = new ArrayList<>();
        public ExecuteImpl(int... vals) {
            for(int val : vals) data.add(val);
        }
        @Override
        public Collection<Integer> exec() {
            return data;
        }
    }
    public static void main(String[] args) {
        List<Execute> x = new ArrayList<>();
        x.add(new ExecuteImpl(1));
        x.add(new ExecuteImpl(2, 3));
        List<Integer> res = x.stream().collect(ArrayList<Integer>::new, (acc,elm) -> acc.addAll(elm.exec()), ArrayList<Integer>::addAll); 
        System.out.println(res);
    }

}
