Link on git.charlesreid1.com: https://git.charlesreid1.com/cs/java/src/master/priority-queues/UnsortedPQ.java
Note: you can find a much more detailed walkthrough of a nearly identical class at Priority Queues/Sorted#Implementation.
The unsorted priority queue makes adding very fast - add operations are O(1), because items are just added to the end of the list, in no particular order.
Removing the minimum item is an O(N) operation, since the entire array must be traversed to find the minimum element. Note that finding the minimum also requires examining every item in the list.
Stacks and QueuesPart of Computer Science Notes
Series on Data Structures
Stacks and Queues: Python
Stacks and Queues: Java
Flags · Template:StacksQueuesFlagBase · e