Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavaÖеÄÖÐÎÄÅÅÐò£¨¼ò¶Ì°æ£©

ÔÚJavaÖУ¬Èç¹ûÔÚ¶ÔÒ»¸öList»òÕßMapÅÅÐò£¬¿ÉÒÔ²ÉÓÃCollectionsµÄ¼¯ºÏÀàÖеÄsort·½·¨À´¶ÔList½øÐÐÅÅÐò¡£ÖÁÓÚmap£¬¿ÉÒÔʹÓÃTreeMap×Ô¶¯ÅÅÐò¡£
µ«ÒÔÉÏÅÅÐò½ö½öÊǶÔÓ¢ÎÄÅÅÐòʱ£¬²Å»áÕýÈ·£¬Èô¹ûÊý¾ÝÀïÃæ´æÔÚÖÐÎĺÍÓ¢ÎÄʱ£¬ÄÇôÅÅÐò¾ÍÂÒÁË¡£
ÏÖÔÚÎÒʵÏֵķ½·¨Êǰ´ÕÕÖÐÎĵį´ÒôÀ´ÅÅÐò¡££¨ÍøÉÏ£¬»¹Óа´±Ê»­ÅÅÐò£¬ÔÚÕâÀïÎҾͲ»Ò»Ò»ÊµÏÖÁË£©
ÈçÏÂÊǶÔMap£¬ÔÚн¨¶ÔÏóʱ£¬¸ømapʵÏÖcomparator½Ó¿Ú¡£
//ΪTreeMapÔö¼ÓÖÐÎÄÅÅÐò
userItems = new TreeMap(new Comparator(){
Collator collator = Collator.getInstance();
public int compare(Object o1, Object o2) {
CollationKey key1 = collator.getCollationKey(o1.toString());
CollationKey key2 = collator.getCollationKey(o2.toString());
return key1.compareTo(key2);
}
});
ͬÑùµÀÀí£¬ÈçÏÂÊǶÔList
ͬÑùҲʹÓÃÁËCollectionsµÄ¼¯ºÏÀàÖеÄsort·½·¨À´¶ÔList½øÐÐÅÅÐò,µ«ÊÇÖØÐ´ÁËcomparatorµÄʵÏÖ·½·¨¡£
//ÖÐÎÄÅÅÐò£¬°´»ú¹¹µÄÃû³Æ¡£
Collections.sort(templist, new Comparator(){
Collator collator = Collator.getInstance();
public int compare(Object o1, Object o2) {
TreeBFOEx org1 = (TreeBFOEx)o1;
TreeBFOEx org2 = (TreeBFOEx)o2;
CollationKey key1 = collator.getCollationKey(org1.getDescription());
CollationKey key2 = collator.getCollationKey(org2.getDescription());
return key1.compareTo(key2);
}
});


Ïà¹ØÎĵµ£º

Using Google is AJAX Search API with Java ...

http://www.ajaxlines.com/ajax/stuff/article/using_google_is_ajax_search_api_with_java.php
I was rather depressed over a year ago when Google deprecated their SOAP Search API with their AJAX Search API. Essentially Google was saying that they didn want anyone programmatically accessing Google search ......

Java clone»úÖÆ

1¡¢ Java¶ÔÏó¸³Öµ
Java´úÂë
Employee e1=
new
 Employee(
"Àî"
); 
//EmployeeÊÇÒ»¸ö×Ô¶¨ÒåÀà 
  
Employee e2=e1; //¸³Öµ¶ÔÏó 
  
e2.setName("Íõ"
);
//¸Ä±ä¶ÔÏóe2µÄÃû×Ö 
  
System.out.println(e1.getName ......

JAVA»ñȡϵͳÐÅÏ¢

Properties props=System.getProperties(); //ϵͳÊôÐÔ
System.out.println("JavaµÄÔËÐл·¾³°æ±¾£º"+props.getProperty("java.version"));
System.out.println("JavaµÄÔËÐл·¾³¹©Ó¦ÉÌ£º"+props.getProperty("java.vendor"));
System.out.println("Java¹©Ó¦É̵ÄURL£º"+props.getProperty("java.vendor.url"));
Syste ......

Java AnnotationÈëÃÅ

ͻ񻣼
±¾ÎÄÕë¶Ôjava³õѧÕß»òÕßannotation³õ´ÎʹÓÃÕßÈ«ÃæµØËµÃ÷ÁËannotationµÄʹÓ÷½·¨¡¢¶¨Ò巽ʽ¡¢·ÖÀà¡£³õѧÕß¿ÉÒÔͨ¹ýÒÔÉϵÄ˵Ã÷ÖÆ×÷¼òµ¥µÄannotation³ÌÐò£¬µ«ÊǶÔÓÚһЩ¸ß¼¶µÄannotationÓ¦Óã¨ÀýÈçʹÓÃ×Ô¶¨ÒåannotationÉú³ÉjavabeanÓ³ÉäxmlÎļþ£©»¹ÐèÒª½øÒ»²½µÄÑо¿ºÍ̽ÌÖ¡£Éæ¼°µ½ÉîÈëannotationµÄÄÚÈÝ£¬×÷Õß½«ÔÚºóÎÄ¡ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ