¼¸¸öjavaÀàµÄÇø±ð
JavaÃæÊÔÖУ¬×î³£±»ÈËÎʵ½µÄ¼¸¸öÎÊÌ⣺
1. java.util.*°üµÄUML½á¹¹Í¼¡£
2. VectorºÍArrayList¡¢LinkedListÇø±ð Hashtable ºÍ HashMapÖ®¼äµÄÇø±ð
3. String¡¢StringBuffer£¬StringBuilderÖ®¼äÇø±ð¡£
--»Ø´ð--
1.
Collection
|
|_List
| |_LinkedList
| |_ArrayList
| |_Vector
|
|_Set
|
|_Map
| |_HashMap
|
|_Compare,Comparetor
|
|_Dictionary
| |_Hashtable
|_ ...
2. LinkedListÄÚ²¿ÒÔÁ´±íÐÎʽ´æ´¢Êý¾Ý
ArrayListÄÚ²¿ÒÔÊý×éÐÎʽ´æ´¢Êý¾Ý¡£
VectorͬArrayList£¬²»¹ýËüÓëArrayList±È½ÏÆðÀ´ÊÇthread-safeµÄ¡£
HashtableÊǼ̳ÐÁËDictionary£¬ÊÇḬ̈߳²È«µÄ¡£HashMapʵÏÖÁËMap½Ó¿Ú£¬²»ÊÇḬ̈߳²È«µÄ¡£
ÈçºÎ±£Ö¤Ḭ̈߳²È«µÄ£¿Ã¿¸öÐÞ¸ÄÈÝÆ÷ÖÐÊý¾ÝµÄ²Ù×÷¶¼ÊÇͬ²½µÄ£¨synchronized£©£¬Òò´Ë±£Ö¤ÁËḬ̈߳²È«¡£
3. StringÊdz¤¶È²»¿É±äµÄ£¬StringBufferºÍStringBuilder³¤¶È¶¼ÊÇ¿ÉÒԱ仯µÄ¡£
StringBufferÊÇḬ̈߳²È«µÄ£¬StringBuilder²»ÊÇḬ̈߳²È«µÄ¡£
StringBuffer ÊÇÒ»×é¿É±äUnicode×Ö·ûµÄÐòÁС£
StringBuilderÊÇÔÚ´¦Àíµ¥Ï̵߳Äʱºò£¬ËÙ¶ÈÒª±ÈÇ°ÕßËٶȿ죬ËùÒÔµ¥Ï̶߳àÓÃStringBuilder¡££¨java5£©
Áí£º
java.lang.StringBufferḬ̈߳²È«µÄ¿É±ä×Ö·ûÐòÁС£Ò»¸öÀàËÆÓÚ String µÄ×Ö·û´®»º³åÇø£¬µ«²»ÄÜÐ޸ġ£ËäÈ»ÔÚÈÎÒâʱ¼äµãÉÏËü¶¼°üº¬Ä³ÖÖÌض¨µÄ×Ö·ûÐòÁУ¬µ«Í¨¹ýijЩ·½·¨µ÷ÓÿÉÒԸıä¸ÃÐòÁеij¤¶ÈºÍÄÚÈÝ¡£
ͨ³££¬Èç¹û sb ÒýÓà StringBuilder µÄÒ»¸öʵÀý£¬Ôò sb.append(x) ºÍ sb.insert(sb.length(), x) ¾ßÓÐÏàͬµÄЧ¹û¡£
java.lang.StringBuilderÒ»¸ö¿É±äµÄ×Ö·ûÐòÁС£´ËÀàÌṩһ¸öÓë StringBuffer ¼æÈÝµÄ API£¬µ«²»±£Ö¤Í¬²½¡£¸ÃÀà±»Éè¼ÆÓÃ×÷ StringBuffer µÄÒ»¸ö¼òÒ×Ìæ»»£¬ÓÃÔÚ×Ö·û´®»º³åÇø±»µ¥¸öÏß³ÌʹÓõÄʱºò£¨ÕâÖÖÇé¿öºÜÆձ飩¡£Èç¹û¿ÉÄÜ£¬½¨ÒéÓÅÏȲÉÓøÃÀ࣬ÒòΪÔÚ´ó¶àÊýʵÏÖÖУ¬Ëü±È StringBuffer Òª¿ì¡£
ÔÚ StringBuilder ÉϵÄÖ÷Òª²Ù×÷ÊÇ append ºÍ insert ·½·¨£¬¿ÉÖØÔØÕâЩ·½·¨£¬ÒÔ½ÓÊÜÈÎÒâÀàÐ͵ÄÊý¾Ý¡£Ã¿¸ö·½·¨¶¼ÄÜÓÐЧµØ½«¸ø¶¨µÄÊý¾Ýת»»³É×Ö·û´®£¬È»ºó½«¸Ã×Ö·û´®µÄ×Ö·û×·¼Ó»ò²åÈëµ½×Ö·û´®Éú³ÉÆ÷ÖС£append ·½·¨Ê¼ÖÕ½«ÕâЩ×Ö·ûÌí¼Óµ½Éú³ÉÆ÷µÄÄ©¶Ë£»¶
Ïà¹ØÎĵµ£º
·½·¨Ò»£º
Map map = new HashMap();
Iterator iter = map.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
Object key = entry.getKey();
Object val = entry.getValue();
}
·½·¨¶þ£º
Map map = n ......
ÎÒ½ñÌìѧϰÁËluceneµÄһЩ֪ʶ£¬ÎÒ×öÁ˼òµ¥µÄ±Ê¼Ç£º
Ë÷ÒýÎļþ½á¹¹£º
µ¹ÅÅË÷Òý£¬Ë÷Òý¶ÔÏóÊÇÎĵµÖеĵ¥´ÊµÈ£¬ÓÃÀ´´æ´¢ÕâЩµ¥´ÊÔÚÒ»¸öÎĵµÖеÄλÖá£ÀýÈ磬ÓÐЩÊéÔÚ×îºóÌṩµÄË÷Òý£¨µ¥´Ê——Ò³ÂëµÄ¶ÔÓ¦ÁÐ±í£©£¬¾Í¿ÉÒÔ¿´³ÉÊÇÒ»ÖÖµ¹ÅÅÐòË÷Òý¡£¿ÉÒÔͨ¹ýһЩ¹Ø¼ü×Ö£¬ÔÚÈ«ÊéÖмìË÷³öÓëÖ®Ïà¹ØµÄ²¿
Ë÷ÒýÎ ......
ÎÒ½ñÌìѧϰÁËÐìÀÏʦ½²µÄejb3µÄ֪ʶ£¬ÎÒ×öÁ˼òµ¥µÄ±Ê¼Ç£º
ÉÏÎç½²µÄÊÇjpaµÄ֪ʶ£¬ÏÂÎç½²µÄÊÇEJB3µÄ֪ʶ£º
JPQLÓï¾ä£ºhibernateµÄHQLÓï¾äÒ»Ñù¡£
¼òµ¥²éѯ:
Query query = em.createQuery("SELECT c from Customer c");
retur ......
Impl
public class BaseDAOImpl extends HibernateDaoSupport implements IBaseDAO
//Ìí¼ÓÊý¾Ý
this.getHibernateTemplate().save(achi);
//ɾ³ý
this.getHibernateTemplate().delete(this.getById(achi));
//²éѯËùÓÐ
return this.getHibernateTemplate().find("from Achievement a ......