Package com.yahoo.log

Class LogMessageTimeComparator

  • All Implemented Interfaces:
    java.io.Serializable, java.util.Comparator<LogMessage>

    public class LogMessageTimeComparator
    extends java.lang.Object
    implements java.util.Comparator<LogMessage>, java.io.Serializable
    Order LogMessage instances based on timestamp. The default ordering is ascending. This may be reversed by the constructor argument. Note: this comparator imposes orderings that are inconsistent with equals. This is due to only looking at the timestamp, so two different messages with the same timestamp would appear "equal" to this comparator.
    Author:
    vlarsen
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(LogMessage message1, LogMessage message2)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • LogMessageTimeComparator

        public LogMessageTimeComparator()
        Create a Time comparator for logmessages. Order is ascending.
      • LogMessageTimeComparator

        public LogMessageTimeComparator​(boolean ascending)
        Create a Time comparator for logmessages. The chronological order is dependent on the argument to the constructor.
        Parameters:
        ascending - true if you want LogMessages ordered ascending according to timestamp.
    • Method Detail