@Test public final void testAddingItems() { final SortedComboBoxModel<String> cbox = new SortedComboBoxModel<>(); for (String item : testItems) { cbox.addElement(item); } verifySortedOrder(cbox); }
@Override public void addElement(E item) { final int insertionPoint = binarySearch(item); if (insertionPoint >= getSize()) { super.addElement(item); } else { super.insertElementAt(item, insertionPoint); } }
SortedComboBoxModel extends DefaultComboBoxModel<E> { @Override public void addElement(E item) { final int insertionPoint = binarySearch(item); if (insertionPoint >= getSize()) { super.addElement(item); } else { super.insertElementAt(item, insertionPoint); } } }
SortedComboBoxModel extends DefaultComboBoxModel<E> { @Override public void addElement(E item) { final int insertionPoint = binarySearch(item); if (insertionPoint >= getSize()) { super.addElement(item); } else { super.insertElementAt(item, insertionPoint); } } SortedComboBoxModel();  SortedComboBoxModel(E[] items); @SuppressWarnings("unchecked")  SortedComboBoxModel(Vector<E> items); }
SortedComboBoxModel extends DefaultComboBoxModel<E> { @Override public void addElement(E item) { final int insertionPoint = binarySearch(item); if (insertionPoint >= getSize()) { super.addElement(item); } else { super.insertElementAt(item, insertionPoint); } } SortedComboBoxModel();  SortedComboBoxModel(E[] items); @SuppressWarnings("unchecked")  SortedComboBoxModel(Vector<E> items); @Override void addElement(E item); @Override void insertElementAt(E item, int index); }
SortedComboBoxModel extends DefaultComboBoxModel<E> { @Override public void addElement(E item) { final int insertionPoint = binarySearch(item); if (insertionPoint >= getSize()) { super.addElement(item); } else { super.insertElementAt(item, insertionPoint); } } SortedComboBoxModel();  SortedComboBoxModel(E[] items); @SuppressWarnings("unchecked")  SortedComboBoxModel(Vector<E> items); @Override void addElement(E item); @Override void insertElementAt(E item, int index);  }