Here you can find the source of generateListModel()
private static DefaultListModel generateListModel()
//package com.java2s; //License from project: Open Source License import javax.swing.*; public class Main { private static ListModel generateListModel(Object[] elements) { DefaultListModel listModel = new DefaultListModel(); if (elements != null) { for (Object o : elements) { listModel.addElement(o); }/*from www. j a v a 2 s . c om*/ } return listModel; } private static DefaultListModel generateListModel(Iterable<?> elements) { DefaultListModel listModel = generateListModel(); if (elements != null) { for (Object o : elements) { listModel.addElement(o); } } return listModel; } private static DefaultListModel generateListModel() { return new DefaultListModel(); } }