Eric Foster cd9f08fe06 myarraylist | 6 anos atrás | |
---|---|---|
.idea | 6 anos atrás | |
src | 6 anos atrás | |
.gitignore | 7 anos atrás | |
README.md | 7 anos atrás | |
generics.iml | 6 anos atrás | |
pom.xml | 7 anos atrás |
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.