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

java compare ½Ó¿Ú

1.±È½Ïºó£¬·µ»Ø0,1,-1 µÄ½á¹û£¬¿ÉÒÔÓÃ
   return (thisVal<anotherVal ? -1 : (thisVal==anotherVal ? 0 : 1));
ЧÂʸü¸ß
ÒÔÏÂת×Ô http://bluelzx.javaeye.com/blog/200987
1.
Á½ÖֱȽϽӿڷÖÎö
ÔÚ

¼¯ºÏ¿ò¼Ü

ÖÐÓÐÁ½ÖֱȽϽӿڣº
Comparable
½Ó¿ÚºÍ
Comparator
½Ó¿Ú¡£
Comparable
ÊÇͨÓõĽӿڣ¬Óû§¿ÉÒÔʵÏÖËüÀ´Íê³É×Ô¼ºÌض¨µÄ±È½Ï£¬¶ø
Comparator
¿ÉÒÔ¿´³ÉÒ»ÖÖËã·¨µÄʵÏÖ£¬ÔÚÐèÒªÈÝÆ÷¼¯ºÏʵÏֱȽϹ¦ÄܵÄʱºò£¬À´Ö¸¶¨Õâ¸ö±È½ÏÆ÷£¬Õâ¿ÉÒÔ¿´³ÉÒ»ÖÖÉè¼Æģʽ£¬½«Ëã·¨ºÍÊý¾Ý·Ö
Àë¡£
Ç°ÕßÓ¦¸Ã±È½Ï¹Ì
¶¨£¬ºÍÒ»¸ö¾ßÌåÀàÏà°ó¶¨£¬¶øºóÕ߱ȽÏÁé»î£¬Ëü¿ÉÒÔ±»ÓÃÓÚ¸÷¸öÐèÒª±È½Ï¹¦ÄܵÄÀàʹÓá£
Ò»¸öÀàʵÏÖÁË
Camparable
½Ó¿Ú±íÃ÷Õâ¸öÀàµÄ¶ÔÏóÖ®¼äÊÇ¿ÉÒÔÏ໥±È½ÏµÄ¡£Èç¹ûÓÃÊýѧÓïÑÔÃèÊöµÄ»°¾ÍÊÇÕâ¸öÀàµÄ¶ÔÏó×é³ÉµÄ¼¯ºÏÖдæÔÚÒ»¸öÈ«Ðò¡£ÕâÑù£¬Õâ
¸öÀà¶ÔÏó×é³ÉµÄ¼¯ºÏ¾Í¿ÉÒÔʹÓÃ
Sort
·½·¨ÅÅÐòÁË¡£
¶ø
Comparator
µÄ×÷ÓÃÓÐÁ½¸ö£º
1
¡¢Èç¹ûÀàµÄÉè¼ÆʦûÓп¼Âǵ½
Compare
µÄÎÊÌâ¶øûÓÐʵÏÖ
Comparable
½Ó¿Ú£¬¿ÉÒÔͨ¹ý
Comparator
À´ÊµÏֱȽÏËã·¨½øÐÐÅÅÐò£»
2
¡¢ÎªÁËʹÓò»Í¬µÄÅÅÐò±ê×¼×ö×¼±¸£¬±ÈÈ磺ÉýÐò¡¢½µÐò»òÆäËûʲôÐò¡£
2 Comparable
½Ó¿Ú
public

interface

Comparable<T> {
   
public

int
compareTo(T o);
}
java.lang.
Comparable
½Ó¿Ú¶¨ÒåÀàµÄ×ÔȻ˳Ðò£¬ÊµÏָýӿڵÄÀà¾Í¿ÉÒÔ°´ÕâÖÖ·½Ê½ÅÅÐò¡£
 
1
£©
int compareTo(Object o):
±È½Ïµ±Ç°ÊµÀý¶ÔÏóÓë¶ÔÏó
o
£¬Èç¹ûλÓÚ¶ÔÏó
o
֮ǰ£¬·µ»Ø¸ºÖµ£¬Èç¹ûÁ½¸ö¶ÔÏóÔÚÅÅÐòÖÐλÖÃÏàͬ£¬Ôò·µ»Ø
0
£¬Èç¹ûλÓÚ¶ÔÏó
o
ºóÃ棬Ôò·µ»ØÕýÖµ¡£
 
2
£©ÔÚ
Java 2 SDK
°æ±¾
1.4
ÖÐÓжþÊ®ËĸöÀàʵÏÖ
Comparable
½Ó¿Ú¡£Ï±íչʾÁË
8
ÖÖ»ù±¾ÀàÐ͵Ä×ÔÈ»ÅÅÐò¡£ËäȻһЩÀ๲ÏíͬһÖÖ×ÔÈ»ÅÅÐò£¬µ«Ö»ÓÐÏ໥¿É±ÈµÄÀà²ÅÄÜÅÅÐò¡£
Àà
ÅÅÐò
BigDecimal,BigInteger,Byte,Double,
Float,Integer,Long,Short
°´Êý×Ö´óСÅÅÐò
Character
°´
Unicode
ÖµµÄÊý×Ö´óСÅÅÐò
String
°´×Ö·û´®ÖÐ×Ö·û
Unicode
ÖµÅÅÐò
ÀûÓÃ
Comparable
½Ó¿Ú´´½¨×Ô¼ºµÄÀàµÄÅÅÐò˳Ðò£¬Ö»ÊÇʵÏÖ
compareTo()
·½·¨µÄÎÊÌ⡣ͨ³£¾ÍÊÇÒÀÀµ¼¸¸öÊý¾Ý³ÉÔ±µÄ×ÔÈ»ÅÅÐò¡£Í¬Ê±ÀàÒ²Ó¦¸Ã¸²¸Ç
equals()
ºÍ
hashCode()
ÒÔÈ·±£Á½¸öÏàµÈµÄ¶ÔÏó·µ»Øͬһ¸ö¹þÏ£Âë¡£
Õâ¸ö½Ó¿ÚµÄ×÷
ÓãºÈç¹ûÊý×é»òÕß¼¯ºÏÖеģ¨ÀࣩÔ


Ïà¹ØÎĵµ£º

IBM FileNet Content Java API ¼ò½é

2008 Äê 6 ÔÂ 24 ÈÕ
Ô­ÎĵØÖ·£º http://www.ibm.com/developerworks/cn/data/library/techarticles/dm-0806wangys/
±¾ÎĽéÉÜ IBM FileNet P8 4.0 Platform ÌṩµÄ Content Java API¡£Ê×ÏÈ¶Ô FileNet P8 Content Engine ºÍ API ½øÐиÅÒª½éÉÜ, ²¢ËµÃ÷ÁËһЩ»ù±¾¸ÅÄËæºóÏêϸ½éÉÜÁË FileNet Content EngineÌṩµÄ»ùÓÚ EJB ......

ÓÃJAVAʵÏÖ¶ÑÕ»£¨Á´±íƪ£©

ʲôÊǶÑÕ»£¬¹ØÓÚÕâ¸öÃû´Ê£¬ÎÒÔڰٶȣ¬googleËÑË÷ÁË°ëÌ죬ҲûÓз¢ÏÖÒ»¸ö±È½ÏȨÍþµÄ½âÊÍ£¬»¹ÓÐÐí¶à×ÊÁÏÓïÑɲ»Ï꣬¾ÍÒÔά»ù°Ù¿ÆµÄ½âÊÍΪ׼°É£¬ºÍÎÒ¼ÇÒäÖеÄÒ»Ö¡£
¶ÑÕ»£¨Ó¢ÎÄ£ºstack£©£¬Öйú´ó½×÷¶ÑÕ»£¬Ì¨Íå×÷¶Ñµþ£¬ÔÚ¼ÆËã»ú¿Æ學ÖУ¬ÊÇÒ»種ÌØÊâµÄ´®ÁÐÐÎʽµÄ資ÁÏ結構£¬ËüµÄÌØÊâÖ®處ÔÚì ......

¹ù¿Ë»ªÀÏʦjavaÊÓƵ½Ì³ÌÏÂÔصØÖ·(J2ME ºÍJ2EE)


1.j2ee
http://0444.xue8xue8.com/computer/program/java/j2eeshuren/00.wmv
http://0444.xue8xue8.com/computer/program/java/j2eeshuren/01.wmv
http://0444.xue8xue8.com/computer/program/java/j2eeshuren/02.wmv
http://0444.xue8xue8.com/computer/program/java/j2eeshuren/03.wmv
http://0444.xue8xue8.com/c ......

java Ïà¶Ô·¾¶

 ×ª×Ô£ºhttp://java.mblogger.cn/sadfasfasd/ 
 ×òÌì¸ãÁ˶¯Ì¬×Ô¶¯¼ÓÔØÅäÖÃÎļþ£¬ÓÖÓöµ½Â·¾¶ÎÊÌ⣬ÕÒµ½ÕâƪºÜ°ôµÄÎÄÕ£¬ÊÕ²Øһϣ¬À´×Ô
http://java.chinaitlab.com/base/532062_3.html  http://www.blogjava.net/killme2008/archive/2007/06/08/122758.html 
      Ç ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ