Code example for Stack

Methods: isEmpty, peek

0
this.currentText = new StringBuilder();
        } 
 
        private void pushTextToTopElement() { 
            if (!elementStack.isEmpty()) { 
                if (currentText.length() > 0) {
                    elementStack.peek().add(text(currentText));
                } 
            } 
            this.currentText = new StringBuilder();
        } 
 
        @Override 
        public void characters(char[] ch, int start, int length) {
            currentText.append(ch, start, length);
        } 
 
        @Override 
        public void endElement(String uri, String localName, String qName) {
            pushTextToTopElement();