Class SortedList<T>

    • Constructor Detail

      • SortedList

        public SortedList​(Comparator<T> cmp,
                          SortOrder sortOrder)
        Complete constructor for a list sorted in ascending or descending order, where the comparison is done by an explicit constructor or the comparable capability of list elements.
        Parameters:
        cmp - External Comparator object or null
        sortOrder - ASCENDING or DESCENDING
      • SortedList

        public SortedList​(SortedList<T> original)
        Copy constructor.
        Parameters:
        original - the SortedList to copy
    • Method Detail

      • add

        public boolean add​(T t)
        Insert the new object at the position given by the Comparator.
        Specified by:
        add in interface Collection<T>
        Specified by:
        add in interface List<T>
        Overrides:
        add in class ArrayList<T>
      • quickInsort

        public boolean quickInsort​(Collection<? extends T> externalObjs)
        Sort the given collection into this. The argument list should be sortable after the same criteria like this, using the same Comparator or Comparable interface.
        Parameters:
        externalObjs - Collection of new objects
        Returns:
        true if this SortedList has been modified
      • quickInsort

        public boolean quickInsort​(T externalObj)
        Sorts a single new object into this.
        Parameters:
        externalObj - new object
        Returns:
        true if this SortedList has been modified