码迷,mamicode.com
首页 > 其他好文 > 详细

Test_21_1

时间:2016-08-08 06:28:52      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:

public class Test_21_1<E> {
    private int pos = 0;
    E array1[] , array2[];
    
    public int getSize(){
        if(array1.length < array2.length)
        return array2.length;
        else return array1.length;
    }
    
    public E peek(){
        // return the top value
        if(array1.length < array2.length)
        return array2[pos];
        else return array1[pos];
    }
    
    public void push(E o){
        //add element
        if(pos < getSize() - 1)
            array[pos] = o;
        else
        {
            
            System.arraycopy(array,0,array1,0,getSize());
            array1[pos] = o;
        }
        pos++;
    }
    
    public E pop(){
        //return and remove the top element
        return 
    }
    
    public E isEmpty(){
        
    }
    public static void main(String[] args) {
        // TODO Auto-generated method stub

    }

}

 

Test_21_1

标签:

原文地址:http://www.cnblogs.com/wanjiang/p/5747861.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!