⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 columncomparator.java

📁 文件上传的java例子
💻 JAVA
字号:
package wjhk.jupload.filepanel;

import java.util.Comparator;
import java.util.Vector;

public class ColumnComparator implements Comparator {
  protected int index;
  protected boolean ascending;

  public ColumnComparator(int index, boolean ascending) {
    this.index = index;
    this.ascending = ascending;
  }

  public int compare(Object one, Object two) {
    if (one instanceof Vector && two instanceof Vector) {
      Object eOne = ((Vector) one).elementAt(index);
      Object eTwo = ((Vector) two).elementAt(index);
      if (eOne instanceof Comparable && eTwo instanceof Comparable) {
        if (ascending) {
          return ((Comparable) eOne).compareTo(eTwo);
        } else {
          return ((Comparable) eTwo).compareTo(eOne);
        }
      }
    }
    return 0;
  }
}

⌨️ 快捷键说明

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