¹ØÓÚjavaµÄhashCode·½·¨
JavaÖеļ¯ºÏ£¨Collection£©ÓÐÁ½À࣬һÀàÊÇList£¬ÔÙÓÐÒ»ÀàÊÇSet¡£ÄãÖªµÀËüÃǵÄÇø±ðÂð£¿Ç°Õß¼¯ºÏÄÚµÄÔªËØÊÇÓÐÐòµÄ£¬ÔªËØ¿ÉÒÔÖظ´£»ºó
ÕßÔªËØÎÞÐò£¬µ«ÔªËز»¿ÉÖظ´¡£ÄÇôÕâÀï¾ÍÓÐÒ»¸ö±È½ÏÑÏÖصÄÎÊÌâÁË£ºÒªÏë±£Ö¤ÔªËز»Öظ´£¬¿ÉÁ½¸öÔªËØÊÇ·ñÖظ´Ó¦¸ÃÒÀ¾ÝʲôÀ´ÅжÏÄØ£¿Õâ¾ÍÊÇ
Object.equals·½·¨ÁË¡£µ«ÊÇ£¬Èç¹ûÿÔö¼ÓÒ»¸öÔªËؾͼì²éÒ»´Î£¬ÄÇôµ±ÔªËغܶàʱ£¬ºóÌí¼Óµ½¼¯ºÏÖеÄÔªËرȽϵĴÎÊý¾Í·Ç³£¶àÁË¡£Ò²¾ÍÊÇ˵£¬Èç¹û
¼¯ºÏÖÐÏÖÔÚÒѾÓÐ1000¸öÔªËØ£¬ÄÇôµÚ1001¸öÔªËؼÓÈ뼯ºÏʱ£¬Ëü¾ÍÒªµ÷ÓÃ1000´Îequals·½·¨¡£ÕâÏÔÈ»»á´ó´ó½µµÍЧÂÊ¡£
ÓÚÊÇ£¬Java²ÉÓÃÁ˹þÏ£±íµÄÔÀí¡£¹þÏ££¨Hash£©Êµ¼ÊÉÏÊǸöÈËÃû£¬ÓÉÓÚËûÌá³öÒ»¹þÏ£Ëã·¨µÄ¸ÅÄËùÒÔ¾ÍÒÔËûµÄÃû×ÖÃüÃûÁË¡£¹þÏ£Ëã·¨Ò²³ÆΪɢÁÐËã·¨£¬ÊÇ
½«Êý¾ÝÒÀÌض¨Ëã·¨Ö±½ÓÖ¸¶¨µ½Ò»¸öµØÖ·ÉÏ¡£Èç¹ûÏêϸ½²½â¹þÏ£Ëã·¨£¬ÄÇÐèÒª¸ü¶àµÄÎÄÕÂƪ·ù£¬ÎÒÔÚÕâÀï¾Í²»½éÉÜÁË¡£³õѧÕß¿ÉÒÔÕâÑùÀí½â£¬hashCode·½·¨Êµ
¼ÊÉÏ·µ»ØµÄ¾ÍÊǶÔÏó´æ´¢µÄÎïÀíµØÖ·£¨Êµ¼Ê¿ÉÄܲ¢²»ÊÇ£©¡£
ÕâÑùÒ»À´£¬µ±¼¯ºÏÒªÌí¼ÓеÄÔªËØʱ£¬Ïȵ÷ÓÃÕâ¸öÔªËصÄhashCode·½·¨£¬¾ÍÒ»ÏÂ×ÓÄܶ¨Î»µ½ËüÓ¦¸Ã·ÅÖõÄÎïÀíλÖÃÉÏ¡£Èç¹ûÕâ¸öλÖÃÉÏûÓÐÔªËØ£¬Ëü¾Í¿ÉÒÔ
Ö±½Ó´æ´¢ÔÚÕâ¸öλÖÃÉÏ£¬²»ÓÃÔÙ½øÐÐÈκαȽÏÁË£»Èç¹ûÕâ¸öλÖÃÉÏÒѾÓÐÔªËØÁË£¬¾Íµ÷ÓÃËüµÄequals·½·¨ÓëÐÂÔªËؽøÐбȽϣ¬ÏàͬµÄ»°¾Í²»´æÁË£¬²»Ïàͬ¾ÍÉ¢
ÁÐÆäËüµÄµØÖ·¡£ËùÒÔÕâÀï´æÔÚÒ»¸ö³åÍ»½â¾öµÄÎÊÌâ¡£ÕâÑùÒ»À´Êµ¼Êµ÷ÓÃequals·½·¨µÄ´ÎÊý¾Í´ó´ó½µµÍÁË£¬¼¸ºõÖ»ÐèÒªÒ»Á½´Î¡£
ËùÒÔ£¬Java¶ÔÓÚeqauls·½·¨ºÍhashCode·½·¨ÊÇÕâÑù¹æ¶¨µÄ£º
1¡¢Èç¹ûÁ½¸ö¶ÔÏóÏàͬ£¬ÄÇôËüÃǵÄhashCodeÖµÒ»¶¨ÒªÏàͬ£»
2¡¢
Èç¹ûÁ½¸ö¶ÔÏóµÄhashCodeÏàͬ£¬ËüÃDz¢²»Ò»¶¨Ïàͬ
ÉÏÃæ˵µÄ¶ÔÏóÏàָͬµÄÊÇÓÃeqauls·½·¨±È½Ï¡£
Ä㵱Ȼ¿ÉÒÔ²»°´ÒªÇóÈ¥×öÁË£¬µ«Äã»á·¢ÏÖ£¬ÏàͬµÄ¶ÔÏó¿ÉÒÔ³öÏÖÔÚSet¼¯ºÏÖС£Í¬Ê±£¬Ôö¼ÓÐÂÔªËصÄЧÂÊ»á´ó´óϽµ¡£
Ïà¹ØÎĵµ£º
package test;
/**
*
* @author openpk
*/
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
public class Main {
public static void main(String[] args) {
// Ï̳߳Ø
ExecutorService exec = Executors ......
ÔÚJAVAÎļþÖлñÈ¡¸ÃÏîÄ¿µÄÏà¶Ô·¾¶
1.»ù±¾¸ÅÄîµÄÀí½â
¡¡¡¡¾ø¶Ô·¾¶£º¾ø¶Ô·¾¶¾ÍÊÇÄãµÄÖ÷Ò³ÉϵÄÎļþ»òĿ¼ÔÚÓ²ÅÌÉÏÕæÕýµÄ·¾¶£¬(URLºÍÎïÀí·¾¶)ÀýÈ磺
C:\xyz\test.txt ´ú±íÁËtest.txtÎļþµÄ¾ø¶Ô·¾¶¡£http://www.sun.com/index.htmÒ²´ú±íÁËÒ»¸ö
URL¾ø¶Ô·¾¶¡£
¡¡¡¡Ïà¶Ô·¾¶£ºÏà¶ÔÓëij¸ö»ù׼Ŀ¼µÄ·¾¶¡£°üº¬WebµÄ ......
Struts¡¢HibernateºÍSpringµÄÇáÐÍJ2EE¼Ü¹¹µÄÑо¿
¹Ø¼ü´Ê Struts£¬Hibernate£¬Spring£¬Óû§¹ÜÀí
Ò»¡¢ÌØÐÔ
1. StrutsÓëMVC
StrutsÊÇApache JakartaÏîÄ¿µÄ×é³É²¿·Ö¡£¸ÃÏîÄ¿µÄÄ¿±êÊÇΪ½¨Á¢Java Web Ó¦ÓóÌÐò¶øÌṩµÄÒ»¸ö¿ªÔ´
¿ò¼Ü¡£Í¨¹ýʹÓÃStruts¿ò¼Ü¿ÉÒԸĽøºÍÌá¸ßJava Server Pages (JSP ......
1. ʼÖÕʹÓà MVC ¿ò¼Ü¡£
½«ÒµÎñÂß¼£¨Java Bean ºÍ EJB ×é¼þ£©´Ó¿ØÖÆÆ÷Âß¼£¨Servlet/Struts ²Ù×÷£©ºÍ±íʾÂß¼£¨JSP¡¢XML/XSLT£©ÖÐÇåÎúµØ·ÖÀë³öÀ´¡£Á¼ºÃµÄ·Ö²ã¿ÉÒÔ´øÀ´Ðí¶àºÃ´¦¡£
×¢:¶ÔÓÚһЩСÐ͵ĻòÕßÒµÎñÏà¶Ô¼òµ¥µÄϵͳ¶øÑÔ,Óÿò¼Ü¿ª·¢²¢²»ÄÜ´øÀ´ÈκÎЧÒæ,²¢ÇÒÎÒÉîÐÅÔÚһЩÏîÄ¿¿ª·¢ÖÐ,ÌرðÊǽö½öÓÉij¸öÈ˶ÀÁ ......