Java Data Structure #10
What I’ve Learned
First, determine whether it’s just Node
or Node.value
.
Disclaimer
For LeetCode, I started learning about data structures on Udemy. I’ve been studying with lecture named Java Data Structures & Algorithms + LEETCODE Exercises.
Stack: Push for a Stack That Uses an ArrayList
public void push(T value){
stackList.add(value);
}
Stack: Pop for a Stack That Uses an ArrayList
public T pop(){
if(isEmpty()) return null;
return stackList.remove(stackList.size()-1);
}