Stacks Flashcards
The stack method to add an element to the stack is
att.push(“Some string”);
Stack<String> att = new Stack<>();</String>
The Stack method to remove an element is
Stack<String> att = new Stack<>()</String>
att.pop();
The Stack method to view an element at the top of the stack is
att.peek();
The Stack method to search an element to return its position in the stack is
att.search(“Some”);
The Stack method to check if a stack is empty is
att.empty(); and returns true or false
To make a list object of type ArrayList you
List<String> list1 = new ArrayList<>();</String>
To make a List object of type LinkedList you
List<String> list1 = new LinkedList<>();</String>
List object methods include
add()
addAll() all elements of one list to another
get() get random element from list