Top Description Fields Constructors Methods
org.yaml.snakeyaml.util

public Class ArrayStack<T>

extends Object
Class Inheritance
Type Parameters
<T>
data to keep in stack
Imports
java.util.ArrayList

Custom stack

Field Summary

Modifier and TypeField and Description
private final ArrayList<T>

Constructor Summary

AccessConstructor and Description
public
ArrayStack(int
- book the size
initSize
)

Create

Method Summary

Modifier and TypeMethod and Description
public void
clear()

remove all items in the stack

public boolean

Returns:

true when it contains nothing
isEmpty
()

Check

public T

Returns:

the head
pop
()

Get the head and remove it from the stack

public void
push(T
- data to be added
obj
)

Add the element to the head

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

stackback to summary
private final ArrayList<T> stack

Constructor Detail

ArrayStackback to summary
public ArrayStack(int initSize)

Create

Parameters
initSize:int

- book the size

Method Detail

clearback to summary
public void clear()

remove all items in the stack

isEmptyback to summary
public boolean isEmpty()

Check

Returns:boolean

true when it contains nothing

popback to summary
public T pop()

Get the head and remove it from the stack

Returns:T

the head

pushback to summary
public void push(T obj)

Add the element to the head

Parameters
obj:T

- data to be added