Class IndexedObject

  • All Implemented Interfaces:
    java.lang.Comparable<IndexedObject>

    public class IndexedObject
    extends java.lang.Object
    implements java.lang.Comparable<IndexedObject>

    Purpose: A helper class for sorting index/object pairs.

    Responsibilities: Allows to sort a list of index/object pairs either directly or with Collections.sort(List) - using IndexedObject.compareTo; or with Collections.sort(List, Comparator) - using custom-defined Comparator.

    See Also:
    Collections, Comparator, OrderedListContainerPolicy
    • Constructor Summary

      Constructors 
      Constructor Description
      IndexedObject​(java.lang.Integer index, java.lang.Object object)  
    • Constructor Detail

      • IndexedObject

        public IndexedObject​(java.lang.Integer index,
                             java.lang.Object object)
    • Method Detail

      • getIndex

        public java.lang.Integer getIndex()
      • setIndex

        public void setIndex​(java.lang.Integer index)
      • getObject

        public java.lang.Object getObject()
      • setObject

        public void setObject​(java.lang.Object object)
      • compareTo

        public int compareTo​(IndexedObject anotherIndexedObject)
        Specified by:
        compareTo in interface java.lang.Comparable<IndexedObject>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object