// 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.List;

public class ListCast {
    public static void main(String[] args) {
        List<Double> dl = new ArrayList<Double>();
        dl.add(1.2);
        dl.add(3.4);
        dl.add(5.6);
        System.out.println(dl);
        Double[] da = (Double[])dl.toArray(new Double[dl.size()]);
        for(double d : da) {
            System.out.println(d);
        }
        List<List<Double>> dll = new ArrayList<List<Double>>();
        dll.add(new ArrayList<Double>());
        dll.add(new ArrayList<Double>());
        dll.add(new ArrayList<Double>());
        dll.get(0).add(1.2);
        dll.get(1).add(3.4);
        dll.get(2).add(5.6);
        System.out.println(dll);
        for(List<Double> l : dll) {
            System.out.println(l.get(0));
        }
    }
}
