Here you can find the source of toList(ListModel model)
public static List toList(ListModel model)
//package com.java2s; /*/*from ww w. j a v a 2 s . com*/ * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2003-2008, Open Source Geospatial Foundation (OSGeo) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ import java.util.ArrayList; import java.util.List; import javax.swing.ListModel; public class Main { public static List toList(ListModel model) { ArrayList list = new ArrayList(model.getSize()); for (int i = 0; i < model.getSize(); i++) { list.add(model.getElementAt(i)); } return (list); } }