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

📄 indexentry.java

📁 Beginning Java 2, SDK 1.4 Edition Exercise Code samples for this book
💻 JAVA
字号:
// Class encapsulating an index to the IndexedPersons.bin file
// Each object stores a second name and the position in the file where
// the corresponding record can be found. i.e. the first record
// is at position 0, the second at position 1, the third at position 2, etc.
import java.io.Serializable;

public class IndexEntry implements Serializable {
  private String name;
  private int position;
  
  public IndexEntry(String name, int position) {
    this.name = name;
    this.position = position;
  }
  
  public String getName() {
    return name;
  }
  
  public int getPosition() {
    return position;
  }
  
  // Method to compare two IndexEntry objects
  public int compareTo(IndexEntry entry) {
    return name.compareTo(entry.name);
  }
}

⌨️ 快捷键说明

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