Code example for Stack

Methods: size

0
    public static TagContext current() { 
        return currentStack.get().peek();
    } 
 
    public static TagContext parent() { 
        if (currentStack.get().size() < 2) {
            return null; 
        } 
        return currentStack.get().get(currentStack.get().size() - 2);
    } 
 
    public static boolean hasParentTag(String name) {
        for (int i = currentStack.get().size() - 1; i >= 0; i--) {
            if (name.equals(currentStack.get().get(i).tagName)) {
                return true; 
            } 
        } 
        return false; 
    }