boardsorderscomparator.java

来自「一个jsp写的bbs」· Java 代码 · 共 51 行

JAVA
51
字号
package com.laoer.bbscs.bean;

import java.util.Comparator;

/**
 * <p>Title: Tianyi BBS</p>
 *
 * <p>Description: BBSCS</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: Laoer.com</p>
 *
 * @author Gong Tianyi
 * @version 7.0
 */
public class BoardsOrdersComparator
    implements Comparator {

  public BoardsOrdersComparator() {
  }

  /**
   * Compares its two arguments for order.
   *
   * @param o1 the first object to be compared.
   * @param o2 the second object to be compared.
   * @return a negative integer, zero, or a positive integer as the first argument is less than,
   *   equal to, or greater than the second.
   * @todo Implement this java.util.Comparator method
   */
  public int compare(Object o1, Object o2) {
    int num1 = ( (Board) o1).getOrders();
    int num2 = ( (Board) o2).getOrders();
    return num1 - num2;

  }

  /**
   * Indicates whether some other object is &quot;equal to&quot; this Comparator.
   *
   * @param obj the reference object with which to compare.
   * @return <code>true</code> only if the specified object is also a comparator and it imposes
   *   the same ordering as this comparator.
   * @todo Implement this java.util.Comparator method
   */
  public boolean equals(Object obj) {
    return this.equals(obj);
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?