Code example for Stack

Methods: empty, pop

0
            if (sPointerInfoFreeList == null) {
                sPointerInfoFreeList = new Stack<PointerInfo>();
            } 
 
            PointerInfo pointerInfo;
            if (sPointerInfoFreeList.empty()) {
                pointerInfo = new PointerInfo();
            } else { 
                pointerInfo = sPointerInfoFreeList.pop();
            } 
 
            pointerInfo.populate(event, index);
            return pointerInfo;
        } 
 
        /* 
         * Fills in the fields of this instance from the given motion event and pointer index 
         * within that event. 
         */ 
        public void populate(MotionEvent event, int index) {
            mId = event.getPointerId(index);