Here you can find the source of listModelEquals(final ListModel
public static <E> boolean listModelEquals(final ListModel<E> lm, final ListModel<E> lm2)
//package com.java2s; //License from project: Open Source License import javax.swing.*; import java.util.Vector; public class Main { public static <E> boolean listModelEquals(final ListModel<E> lm, final ListModel<E> lm2) { for (int i = 0; i < lm.getSize(); i++) { if (!lm.getElementAt(i).equals(lm2.getElementAt(i))) return false; }//w w w. j av a 2s . c om return true; } public static <E> boolean listModelEquals(final ListModel<E> lm, final E[] e2) { for (int i = 0; i < lm.getSize(); i++) { if (!lm.getElementAt(i).equals(e2)) return false; } return true; } public static <E> boolean listModelEquals(final ListModel<E> lm, final Vector<E> lm2) { for (int i = 0; i < lm.getSize(); i++) { if (!lm.getElementAt(i).equals(lm2.elementAt(i))) return false; } return false; } }