Java Sets

While we didn’t look at creating a Set, we could have with several of the data structures we built – such as the binary tree if we didn’t allow duplicate data, or by searching our linked list before adding the element. It turns out that Java doesn’t provide a single Set type, but actually multiple…

Java Linked List

Along with other Java collections, there is a Linked List. You will want to use a parameterized constructor to work easier with Java Linked List. As a linked list, it has container elements which will store the data and allow you to navigate through it. We saw many of the methods used for a Linked…

Java Stacks

The Stack class is found in java.util and it extends the Vector Class. This means it can grow and shrink as needed, which is helpful for a Stack. As it extends a Vector, it is helpful to Parameterize the constructor. Just like the Stack that we’ve created, it has the same methods: push(), pop(), and…

Java’s Vector Class

The Vector, in Java, effectively implements a dynamic array like in other languages. This is because Java’s array is static in size, like the one’s found in C/C++. The vector can use an index to identify a specific element, however, it can grow and shrink based upon the size needs of the vector. Since early…

Built in Java Classes

Most modern languages support many of the data types we’ve looked at so far this term, including Stacks, Queues, Hash Maps/Dictionaries, and more. Many of these are supported within the language itself, often through a utility package, or something similar which can be imported, or from a third party library that can be imported. Which…