Êý¾Ý½á¹¹(LinkedListµÄjavaʵÏÖ)
package day10;
import java.util.*;
public class MyLinkedList implements List
{
static class Node
{
public Object data;
public Node next;
public Node(Object data)
{
this.data=data;
}
}
private Node head;
public MyLinkedList()
{
head=new Node(0);
}
public void add(int index, Object element)
{
if(index<(Integer)head.data)
{
Node current;
current=head;
for(int i=0;i<index;i++)
{
current=current.next;
}
Node p=new Node(element);
p.next=current.next;
current.next=p;
head.data=(Integer)head.data+1;
}
else
{
System.out.println("ERROR!");
}
}
@Override
public boolean add(Object e)
{
Node current=head;
while(current.next!=null)
{
current=current.next;
}
Node p=new Node(e);
current.next=p;
head.data=(Integer)head.data+1;
return true;
}
@Override
public boolean addAll(Collection c) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean addAll(int index, Collection c) {
// TODO Auto-generated method stub
return false;
}
@Override
public void clear()
{
head.next=null;
}
@Override
public boolean contains(Object o)
{
Node current=head;
while(current.next!=null)
{
current=current.next;
if(current.data.equals(o))
{
return true;
}
}
return false;
}
@Override
public boolean containsAll(Collection c)
{
// TODO Auto-generated method stub
return false;
}
@Override
public Object get(int index)
{
Node current;
current=head.next;
for(int i=0;i<index;i++)
{
current=current.next;
}
return current.data;
}
@Override
public int indexOf(Object o)
{
int i;
Node current=head;
for(i=0;i<(Integer)head.data;i++)
{
current=current.next;
if(current.data.equals(o))
{
break;
}
}
if(i<(Integer)head.data)
{
return i;
}
return -1;
}
@Override
public boolean isEmpty()
{
if(head.next!=null)
{
return true;
}
return false;
}
@Override
public Iterator iterator()
{
return new Iterator()
{
Nod
Ïà¹ØÎĵµ£º
×ªÔØ×Ô http://www.cn-java.com/www1/?action-viewnews-itemid-8283
ÓÉÓÚͬһ½ø³ÌµÄ¶à¸öÏ̹߳²ÏíͬһƬ´æ´¢¿Õ¼ä£¬ÔÚ´øÀ´·½±ãµÄͬʱ£¬Ò²´øÀ´ÁË·ÃÎʳåÍ»Õâ¸öÑÏÖØµÄÎÊÌâ¡£JavaÓïÑÔÌṩÁËרÃÅ»úÖÆÒÔ½â¾öÕâÖÖ³åÍ»£¬ÓÐЧ±ÜÃâÁËͬһ¸öÊý¾Ý¶ÔÏó±»¶à¸öÏß³Ìͬʱ·ÃÎÊ¡£
¡¡¡¡ÐèÒªÃ÷È·µÄ¼¸¸öÎÊÌ⣺
¡¡¡¡1)synchronized¹Ø¼ü×Ö¿ÉÒÔ×÷Ϊ ......
Berkely DB¶ÔÓڸ߲¢·¢¡¢ÒªÇóËÙ¶È¿ìµÄÓ¦ÓÃÀ´ËµÊǸö²»´íµÄÑ¡Ôñ£¬mysql¾ÍÊÇÓÃBDBʵÏÖµÄ(mysqlµÄºǫ́) £¬mysql¿ì£¬BDB±Èmysql»¹Òª¿ìN±¶¡£BDBÊÇÒ»ÖÖǶÈëʽµÄ¡¢·Ç¹ØÏµÊý¾Ý¿â£¬ËüÓëÆäËûµÄ¹ØÏµÊý¾Ý¿âRMDBS²»Í¬,ËüûÓÐÌṩSQL,¶øÊÇÌṩÁË×Ô¼ºµÄ·ÃÎʽӿڡ£×÷ΪһÖÖǶÈëʽµÄÊý¾Ý¿â£¬ËüÊǽø³ÌÄÚģʽµÄ£¬Ò²¾ÍÊÇ˵ËüºÍÓ¦ÓóÌÐòÔÚͬһÄÚ´æ¿ ......
JAVA annotationÈëÃÅ
×î½ü¶ÔspringÔ´Âë¸ÐÐËȤ£¬½ñÌì¿´µ½annotation²¿·Ö£¬ÂÔ¼ÇÖ®¡£
Ò». ×î³£¼ûµÄannotation
@Override:ÓÃÔÚ·½·¨Ö®ÉÏ£¬ÓÃÀ´¸æËß±ðÈËÕâÒ»¸ö·½·¨ÊǸÄд¸¸ÀàµÄ
@Deprecated:½¨Òé±ðÈ˲»ÒªÊ¹ÓþɵÄAPIµÄʱºòÓõÄ,±àÒëµÄʱºò»áÓòúÉú¾¯¸æÐÅÏ¢,¿ÉÒÔÉ趨ÔÚ ......
JavaÉè¼ÆÄ£Ê½Ö®Singletonµ¥Àýģʽƪ
java µ¥ÀýģʽµÄʵÏÖ·½Ê½
ʵÏÖ1£º
public class Singleton {
private static Singleton instance;
private Singleton (){ //Ê×ÏÈÓÐÒ»¸ö˽ÓеĹ¹ÔìÆ÷
}
......
²ÉÓô®¿Ú²Ù×÷½øÐжÌÐÅÊÕ·¢,ÊDZȽϳ£¼ûµÄÒ»ÖÖ·½Ê½.±ÈÈç,ºÜ¶àȺ·¢Èí¼þ,ÓõľÍÊÇÕâÖÖ·½·¨.
1.ÅäÖÃcomm.jar.
Comm.jarÊÇSubʵÏֵײ㴮¿Ú²Ù×÷µÄAPI,µ÷ÓÃÁ˱¾µØµÄDLLÎļþ,ÒòΪJava±¾Éí²»¾ß±¸Ö±½Ó·ÃÎÊÓ²¼þÉèÖõÄÄÜÁ¦,¶¼ÊÇͨ¹ýµ÷Óñ¾µØ·½·¨À´ÊµÏÖµÄ.¿ÉÒÔJavaµÄ¹Ù·½ÍøÕ¾ÏÂÔØ.ÏÂÔØÖ®ºó°ÑÆäÖÐComm.jar°üµ¼Èëµ½¹¤³ÌµÄClasspathÖÐ,°ÑÁí ......