Code example for Stack

Methods: get, size

0
 
    private int getParentIndex() 
    { 
        int parentIndex = 0;
 
        parentIndex = stack.size() - 2;
 
        return parentIndex;
    } 
 
    private boolean isParentElement( String parentElement )
    { 
        boolean isParent = false;
 
        isParent = stack.get( getParentIndex() ).toString().equals( parentElement );
 
        return isParent;
    } 
}