Seth e7d9dc962f addindex | 6 年前 | |
---|---|---|
.idea | 6 年前 | |
src | 6 年前 | |
.gitignore | 7 年前 | |
README.md | 7 年前 | |
generics.iml | 6 年前 | |
pom.xml | 7 年前 |
Fork this repository and commit your code to your fork. You should have many commits, not just one for the whole project. Submit your code with a pull request.
In this lab you'll practice using generics in Java to implement your own versions of ArrayList, Set, and Map from scratch.
As always, you are required to produce UML and unit tests as well as your code to solve these problems. You should be following proper test driven development practices and have UML that outlines your planned implementation before you implement the code.
Implement your own version of an ArrayList (we'll call it MyArrayList), with the following features:
add()
, get()
, remove()
, set()
, clear()
, isEmpty()
, contains()
and other methods to provide the same basic functionality described in the ArrayList documentationadd()
should be overridden to add an element to the end of the Array, or to add the element to a specified index in the array.MyArrayList()
) to initialize a new instance, it should also have a one-argument constructor (MyArrayList(int)
) that takes an int and starts the list off at the specified size.Implement your own version of a Set (let's call it MySet ... seeing a pattern here?), with the following features:
Implement your own version of a Map (MyMap) as a generic type that can map any key type to any value type.
MyMap should implement all of the methods and behavior described in the Java Map documentation.