ÓÃJAVAʵÏÖ¶ÑÕ»£¨Á´±íƪ£©
ʲôÊǶÑÕ»£¬¹ØÓÚÕâ¸öÃû´Ê£¬ÎÒÔÚ°Ù¶È£¬googleËÑË÷Á˰ëÌ죬ҲûÓз¢ÏÖÒ»¸ö±È½ÏȨÍþµÄ½âÊÍ£¬»¹ÓÐÐí¶à×ÊÁÏÓïÑɲ»Ï꣬¾ÍÒÔά»ù°Ù¿ÆµÄ½âÊÍΪ׼°É£¬ºÍÎÒ¼ÇÒäÖеÄÒ»Ö¡£
¶ÑÕ»£¨Ó¢ÎÄ£ºstack£©£¬Öйú´ó½×÷¶ÑÕ»£¬Ì¨Íå×÷¶Ñµþ£¬ÔÚ¼ÆËã»ú¿Æ學ÖУ¬ÊÇÒ»種ÌØÊâµÄ´®ÁÐÐÎʽµÄ資ÁÏ結構£¬ËüµÄÌØÊâÖ®處ÔÚì¶Ö»ÄÜÔÊ許ÔÚ鏈結´®Áлò陣ÁеÄÒ»¶Ë£¨稱為¶Ñ疊頂¶ËÖ¸標£¬Ó¢ÎÄ為top£©進ÐмÓÈë資ÁÏ£¨push£©ºÍ輸³ö資ÁÏ£¨pop£©µÄ運Ëã¡£ÁíÍâ¶Ñ疊Ò²¿ÉÒÔÓÃÒ»維陣Áлò連結´®ÁеÄÐÎʽ來Íê³É¡£¶Ñ疊µÄÁíÍâÒ»個Ïà對µÄ²Ù×÷·½Ê½稱為佇ÁС£
ÓÉì¶¶Ñ疊資ÁÏ結構Ö»ÔÊ許ÔÚÒ»¶Ë進ÐвÙ×÷£¬Òò¶ø°´ÕÕáá進Ïȳö£¨LIFO, Last In First Out£©µÄÔÀí運×÷¡£
¶Ñ疊資ÁÏ結構ʹÓÃ兩種»ù±¾²Ù×÷£ºÍÆÈ루push£©ºÍ彈³ö£¨pop£©£º
ÍÆÈ루push£© £º將數據·ÅÈë¶Ñ疊µÄ頂¶Ë£¨陣ÁÐÐÎʽ»ò´®ÁÐÐÎʽ£©£¬¶Ñ疊頂¶ËtopÖ¸標¼ÓÒ»¡£
彈³ö£¨pop£© £º將頂¶Ë數據資ÁÏ輸³ö£¨»Ø傳£©£¬¶Ñ疊頂¶Ë資ÁÏ減Ò»¡£
ÏÂÃæÊÇÓÃjava Á´±í ʵÏÖ¶ÑÕ»
/**
* ±íʾÁ´±íµÄÒ»¸ö½Úµã
* @author Adair
*/
public class Node{
Object element;
Node next;
public Node(Object element) {
this(element, null);
}
public Node(Object element, Node n) {
this.element = element;
next = n;
}
public Object getElement() {
return element;
}
public void setElement(Object element) {
this.element = element;
}
public Node getNext() {
return next;
}
public void setNext(Node next) {
this.next = next;
}
}
/**
* ÓÃÁ´±íʵÏÖ¶ÑÕ»
* @author Adair
*/
public class ListStack
{
Node header; //Õ»¶¥ÔªËØ
int elementCount;// Õ»ÄÚÔªËØ¸öÊý
int size;// Õ»µÄ´óС
/**
* ¹¹Ô캯Êý£¬¹¹ÔìÒ»¸ö¿ÕµÄ¶ÑÕ»
*/
public ListStack()
{
header = null;
elem
Ïà¹ØÎĵµ£º
¶ÔListµÄ±éÀúÓÐÈýÖÖ·½Ê½
List<A> list = new ArrayList<A>();
list.add(new A());
list.add(new & ......
JavaÖÐÌṩÁËClassÀ࣬¿ÉÒÔͨ¹ýClassÀà»ñÈ¡ÀàµÄ¶¨ÒåÐÅÏ¢£¬°üÀ¨°üÃû¡¢ÀàÃû¡¢ÀàÉϵÄ×¢ÊÍ£¨Annotation£©¡¢ÀàµÄÐÞÊηû¡¢¸¸Àà¡¢¼Ì³ÐµÄ½Ó¿Ú¡¢¹¹Ôì·½·¨¡¢³ÉÔ±±äÁ¿ºÍ³ÉÔ±·½·¨¡£ÕâЩÐÅÏ¢·Ö±ðʹÓÃjava.lang.annotation.Annotation¡¢ java.lang.reflect.Constructor¡¢java.lang.reflect.Field¡¢java.lang.reflect.Method¡¢java.lang.re ......
ʹÓÃiTextÀ´²ð·ÖpdfÎļþÏà±ÈPDFBOXÒª¸´ÔÓÒ»µã¡£ÒÔÏÂʾÀýʵÏÖÁ˲ð·ÖPDFÎļþΪµ¥Ò³Îļþ£¬²¢±£´æÎª“ÎļþÃû-n.pdf”µÄÎļþ£º
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentExce ......
ʲôÊǶÑÕ»£¬¹ØÓÚÕâ¸öÃû´Ê£¬ÎÒÔÚ°Ù¶È£¬googleËÑË÷Á˰ëÌ죬ҲûÓз¢ÏÖÒ»¸ö±È½ÏȨÍþµÄ½âÊÍ£¬»¹ÓÐÐí¶à×ÊÁÏÓïÑɲ»Ï꣬¾ÍÒÔά»ù°Ù¿ÆµÄ½âÊÍΪ׼°É£¬ºÍÎÒ¼ÇÒäÖеÄÒ»Ö¡£
¶ÑÕ»£¨Ó¢ÎÄ£ºstack£©£¬Öйú´ó½×÷¶ÑÕ»£¬Ì¨Íå×÷¶Ñµþ£¬ÔÚ¼ÆËã»ú¿Æ學ÖУ¬ÊÇÒ»種ÌØÊâµÄ´®ÁÐÐÎʽµÄ資ÁÏ結構£¬ËüµÄÌØÊâÖ®處ÔÚì ......