Java?????Stack ??????
???????????? ???????[ 2015/1/12 13:31:20 ] ????????Java Stack
????1.???
????????????????????????????????????????????????????????????к?????ó?????Java API?????????Stacck)??????????????????
package com.test.collections;
import java.util.Stack;
public class StackTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Stack<String> stack = new Stack<String>();
stack.add("China");
stack.add("Japan");
stack.add("Russia");
stack.add("England");
System.out.println(stack.size()+"<="+stack.capacity());
System.out.println(stack.elementAt(0));
System.out.println(stack.get(0));
System.out.println(stack.peek());
System.out.println(stack.push("France"));
System.out.println(stack.pop());
System.out.println(stack.iterator());
System.out.println(stack.empty());
System.out.println(stack.isEmpty());<br>??????????????????System.out.println(stack.search("Russia"));
}
}
|
????2.??н?
????Stack??????Vector????Vector??????AbstractList???????????List????Cloneable????RandomAcces??????Serializable????????????Vector????????????????ListItr??Itr??Itr????Vector?????????Iterator??????ListItr??????Itr??????????ListIterator????
????3.?????
???????Stack??????е??????pop()??peek()??push(Object)??search(Object)??empty()???????????????????Vector???ж?????????????????Vector?м??????????protected Object[] elementData??protected int elementCount;protected int capacityIncrement;private static final int MAX_ARRAY_SIZE = 2147483639;????????????????????Stack???????????????????elementData???????Stack?е????????elementCount????????????????????capacityIncrement????????Stack????????????????????????elementCount????MAX_ARRAY_SIZE ????????Stack????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11