David Ginzberg před 7 roky
rodič
revize
f923ce8756
1 změnil soubory, kde provedl 39 přidání a 2 odebrání
  1. 39
    2
      README.md

+ 39
- 2
README.md Zobrazit soubor

@@ -1,2 +1,39 @@
1
-# Generics
2
-Repository for Generics labs
1
+# Generics Lab
2
+
3
+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.
4
+
5
+## Description
6
+
7
+In this lab you'll practice using generics in Java to implement your own versions of ArrayList, Set, and Map from scratch.
8
+
9
+## Requirements
10
+
11
+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.
12
+
13
+## Instructions
14
+
15
+### Part 1:
16
+
17
+Implement your own version of an ArrayList (we'll call it MyArrayList), with the following features:
18
+
19
+- MyArrayList must be a generic type, which can store any other type of object
20
+- MyArrayList must not use List, ArrayList or any other collection type in its implementation, only Arrays (The purpose of this is to practice designing your own generic class from the ground up, so that you can appreciate their complexities and usefulness)
21
+- MyArrayList must have `add()`, `get()`, `remove()`, `set()`, `clear()`, `isEmpty()`, `contains()` and other methods to provide the same basic functionality described in the [ArrayList documentation](https://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html)
22
+- `add()` 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.
23
+- MyArrayList must have a no-argument constructor (`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.
24
+- MyArrayList should automatically resize and maintain its order.
25
+
26
+### Part 2:
27
+
28
+Implement your own version of a Set (let's call it MySet ... seeing a pattern here?), with the following features:
29
+
30
+- MySet must be a generic type, which can store any other type of object
31
+- An instance of MySet must contain no duplicates
32
+- MySet must not use List, ArrayList, or any other built-in collection types in its implementation. You may use Arrays, and you may use your implementation of MyArrayList (if it helps -- you don't have to use it)
33
+- MySet must have all of the methods listed on the [Java Set documentation](https://docs.oracle.com/javase/7/docs/api/java/util/Set.html)
34
+
35
+### Part 3 (Challenge):
36
+
37
+Implement your own version of a Map (MyMap) as a generic type that can map any key type to any value type.
38
+
39
+MyMap should implement all of the methods and behavior described in the [Java Map documentation](https://docs.oracle.com/javase/7/docs/api/java/util/Map.html).