Java JList Model listModelEquals(final ListModel lm, final ListModel lm2)

Here you can find the source of listModelEquals(final ListModel lm, final ListModel lm2)

Description

list Model Equals

License

Open Source License

Declaration

public static <E> boolean listModelEquals(final ListModel<E> lm, final ListModel<E> lm2) 

Method Source Code


//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;
    }
}

Related

  1. getListModel(T[] data)
  2. hasOnlyValue(final ListModel model, final Object value)
  3. indexesOf(DefaultListModel model, String sa[])
  4. indexOf(Object obj, ListModel model)
  5. listAsListModel(ArrayList list)
  6. remove(final DefaultListModel list, final int[] indices)
  7. removeAll(DefaultListModel m, List o)
  8. removeFromList(String path, DefaultListModel model, JList list)
  9. setListModel(ListModel model, JList list)