Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4512968

Desire built-in sorting support for JList/DefaultListModel

    XMLWordPrintable

Details

    • Fix Understood
    • generic
    • generic

    Description

      Name: bsT130419 Date: 10/10/2001


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      I think it would be really nice for JList/DefaultListModel to support
      built-in key sorting. Certainly it can be done manually, but it is useful
      enough, and easy enough that I think it deserves inclusion to the built-in
      classes. I would think a built-in function could be made more efficient than an
      external one, at least more efficient than my quick-and-dirty solution.

      The format would be something like this:

      public class DefaultListModel2 extends DefaultListModel
      {
        public static final int ORDER_LOW_FIRST=0;
        public static final int ORDER_HIGH_FIRST=1;
        public void sortToString(int order) {...} //sort by object.toString()
        public void sort(int order) {...} //sort with ((Comparable)o1).compare(o2)
      }
      (Review ID: 133439)
      ======================================================================

      Attachments

        Activity

          People

            Unassigned Unassigned
            bstrathesunw Bill Strathearn (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Imported:
              Indexed: