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

📄 sortcomparator.java

📁 基于WINCE5.0的ARM嵌入式手机上层软件开发
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package PhoneBook;import javax.microedition.rms.*;/** * * @author Administrator */public class SortComparator implements RecordComparator {	private String name_1 , name_2;	public int compare(byte[] rec1,byte[] rec2){		BookAccount account = null;		try{		account = BookAccount.deserialize(rec1);		name_1 = account.getUserName();		account = BookAccount.deserialize(rec2);		name_2 = account.getUserName();		account = null;		}catch(Exception e){			account = null;			System.out.println("deserialize error");		}		//按照名字顺序排序		if(name_1.compareTo(name_2)==0)		  {		     return RecordComparator.EQUIVALENT;		  }		  else if(name_1.compareTo(name_2)<0)		  {		    return RecordComparator.PRECEDES;		 }		return RecordComparator.FOLLOWS;	}}

⌨️ 快捷键说明

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