java¿ªÔ´Àà¿âpinyin4jµÄʹÓÃ
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import net.sourceforge.pinyin4j.PinyinHelper;
public class PinyinComparator implements Comparator<Object> {
private String concatPinyinStringArray(String[] pinyinArray) {
StringBuffer pinyinStrBuf = new StringBuffer();
if ((null != pinyinArray) && (pinyinArray.length > 0)) {
for (int i = 0; i < pinyinArray.length; i++) {
pinyinStrBuf.append(pinyinArray[i]);
}
}
String outputString = pinyinStrBuf.toString();
return outputString;
}
public int compare(Object o1, Object o2) {
int length1 = ((String) o1).length();
int length2 = ((String) o2).length();
int length = length1 - length2 > 0 ? length2 : length1;
for (int i = 0; i < length; i++) {
char c1 = ((String) o1).charAt(i);
char c2 = ((String) o2).charAt(i);
String c1topinyin = concatPinyinStringArray(PinyinHelper.toHanyuPinyinStringArray(c1));
String c2topinyin = concatPinyinStringArray(PinyinHelper.toHanyuPinyinStringArray(c2));
&nbs
Ïà¹ØÎĵµ£º
1¡¢ ¶ÔÏóµÄ³õʼ»¯
(1) ·Ç¾²Ì¬¶ÔÏóµÄ³õʼ»¯
ÔÚ´´½¨¶ÔÏóʱ£¬¶ÔÏóËùÔÚÀàµÄËùÓÐÊý¾Ý³ÉÔ±»áÊ×ÏȽøÐгõʼ»¯¡£
»ù±¾ÀàÐÍ£ºintÐÍ£¬³õʼ»¯Îª0¡£
Èç¹ûΪ¶ÔÏó£ºÕâЩ¶ÔÏó»á°´Ë³Ðò³õʼ»¯¡£
¡ùÔÚËùÓÐÀà³ÉÔ±³õʼ»¯Íê³ÉÖ®ºó£¬²Åµ÷Óñ¾ÀàµÄ¹¹Ôì·½·¨´´½¨¶ÔÏó¡£
¹¹Ôì·½·¨µÄ×÷ÓþÍÊdzõʼ»¯ ......
1. ÔĶÁÏÂÁдúÂë»Ø´ðÎÊÌ⣨µÚÒ»¸öJava³ÌÐò£¬Àí½âPATHºÍCLASSPATH£¬Ñ§»áʹÓÃjavacºÍjavaÃüÁ
view plaincopy to clipboardprint?
package cn.edu.uibe;
public class HelloWorld {
public static void main(String[] args) {
&nb ......
instanceofÊÇJavaµÄÒ»¸ö¶þÔª²Ù×÷·û£¬ºÍ==£¬>£¬<ÊÇͬһÀණ¶«¡£ÓÉÓÚËüÊÇÓÉ×Öĸ×é³ÉµÄ£¬ËùÒÔÒ²ÊÇJavaµÄ±£Áô¹Ø¼ü×Ö¡£ËüµÄ×÷ÓÃÊDzâÊÔËü×ó±ßµÄ¶ÔÏóÊÇ·ñÊÇËüÓұߵÄÀàµÄʵÀý£¬·µ»ØbooleanÀàÐ͵ÄÊý¾Ý¡£¾Ù¸öÀý×Ó£º
¡¡¡¡String s = "I AM an Object!";
¡¡¡¡boolean isObject = s instanceof Object;
¡¡¡¡ÎÒÃÇÉùÃ÷ÁËÒ»¸öSt ......
J2ME£¬ÏÖ³ÆΪJava ME(Java Platform, Micro Edition )ÊÇΪ»ú¶¥ºÐ¡¢Òƶ¯µç»°ºÍPDAÖ®ÀàǶÈëʽÏû·Ñµç×ÓÉ豸ÌṩµÄJavaÓïÑÔƽ̨£¬°üÀ¨ÐéÄâ»úºÍһϵÁбê×¼»¯µÄJava API¡£ËüºÍJava SE¡¢Java EEÒ»Æð¹¹³ÉJava¼¼ÊõµÄÈý´ó°æ±¾£¬²¢ÇÒͬÑùÊÇͨ¹ýJCP£¨Java Community Process£©Öƶ©µÄ¡£
Ä¿Ç°½×¶Î£¬Java ME×îÁ÷ÐеÄÓ¦ÓÃÊÇÓÎÏ·Èí¼þ¡£ÒòÎ ......