code: @SuppressWarnings("unchecked")
      private static <T extends Comparable<T>> int compare(T o1, T o2) {
          if (o1 instanceof PMessage && o2 instanceof PMessage) {
              return compareMessages((PMessage) o1, (PMessage) o2);
          }
          return o1.compareTo(o2);
      }
docs: Compare two values to each other.
  
  @param o1 The first value.
  @param o2 The second value.
  @param <T> The object type.
  @return The compare value (-1, 0 or 1).