Kaynağa Gözat

first 4 parts completed

ahsonali 6 yıl önce
ebeveyn
işleme
f842ebb1fd

+ 4
- 4
src/main/java/Pair/Arrays.java Dosyayı Görüntüle

@@ -10,7 +10,7 @@ import java.util.Collections;
10 10
  * A max method that returns the largest item in the arraylist
11 11
  * And a minmax method that returns a pair containing the largest and smallest items from the array list
12 12
  */
13
-public class Arrays {
14
-    public static <___> Pair<E> firstLast(ArrayList<___> a) {
15
-    }
16
-}
13
+//public class Arrays {
14
+//    public static <___> Pair<E> firstLast(ArrayList<___> a) {
15
+//    }
16
+//}

+ 32
- 1
src/main/java/StackArray/GenericStack.java Dosyayı Görüntüle

@@ -10,6 +10,37 @@ import java.util.Arrays;
10 10
 public class GenericStack<E> {
11 11
     private E[] elements;
12 12
 
13
-    public GenericStack() {
13
+    public GenericStack()
14
+    {
15
+        this.elements =  (E[]) new Object[0];
14 16
     }
17
+
18
+    public void push(E value)
19
+    {
20
+        E[] newArray = Arrays.copyOf(elements, elements.length +1);
21
+        newArray[newArray.length - 1] = value;
22
+        this.elements = newArray;
23
+    }
24
+    public boolean isEmpty()
25
+    {
26
+        if (this.elements.length == 0)
27
+        {
28
+            return true;
29
+        }
30
+        return false;
31
+
32
+    }
33
+
34
+
35
+    public E pop()
36
+    {
37
+        E value = elements[elements.length - 1];
38
+        E[] newArray = Arrays.copyOf(elements, elements.length - 1);
39
+        this.elements = newArray;
40
+        return value;
41
+    }
42
+
43
+
44
+
45
+
15 46
 }

+ 31
- 2
src/main/java/StackArray/ObjectStack.java Dosyayı Görüntüle

@@ -7,10 +7,39 @@ import java.util.Arrays;
7 7
  * Remember, you might need to resize the stack in the push method.
8 8
  * @param <E>
9 9
  */
10
-public class ObjectStack<E> {
10
+public class ObjectStack<E>
11
+{
11 12
     private Object[] elements;
12 13
 
13
-    public ObjectStack() {
14
+    public ObjectStack()
15
+    {
16
+        this.elements = new Object[0];
14 17
 
15 18
     }
19
+
20
+    public void push(Object value)
21
+    {
22
+        Object[] newArray = (E[])Arrays.copyOf(elements, elements.length + 1);
23
+        newArray[newArray.length - 1] = value;
24
+        this.elements = newArray;
25
+    }
26
+
27
+    public Object pop()
28
+    {
29
+        Object value = elements[elements.length - 1];
30
+        Object[] newArray = Arrays.copyOf(elements, elements.length - 1);
31
+        this.elements = newArray;
32
+        return value;
33
+
34
+    }
35
+
36
+    public boolean isEmpty()
37
+    {
38
+        if(this.elements.length == 0)
39
+        {
40
+            return true;
41
+        }
42
+
43
+        return false;
44
+    }
16 45
 }

+ 20
- 3
src/main/java/StackArrayList/Stack.java Dosyayı Görüntüle

@@ -6,11 +6,28 @@ import java.util.ArrayList;
6 6
  * Implement Stack<E> by adding the push, pop, and isEmpty functions.  It must pass the prewritten unit tests.
7 7
  * If you pop on an empty stack, throw an IndexOutOfBoundsException.
8 8
  */
9
-public class Stack<E> {
10
-    private ArrayList elements;
9
+public class Stack<E>
10
+{
11
+    private ArrayList<E> elements;
11 12
 
13
+    public Stack() { this.elements = new ArrayList(); }
12 14
 
13
-    public Stack(){
15
+    public boolean isEmpty()
16
+    {
17
+        return this.elements.size() == 0;
18
+    }
19
+
20
+    public void push(E value)
21
+    {
22
+        elements.add(value);
23
+    }
24
+
25
+    public E pop()
26
+    {
27
+        //Get the last element before removing it
28
+        E value = elements.get(elements.size() - 1);
29
+        elements.remove(elements.size() - 1);
14 30
 
31
+        return value;
15 32
     }
16 33
 }

+ 41
- 2
src/main/java/Table/Table.java Dosyayı Görüntüle

@@ -10,8 +10,47 @@ import java.util.ArrayList;
10 10
  * Void return on `remove`.
11 11
  */
12 12
 public class Table<K, V> {
13
-    private ArrayList entries;
13
+    private ArrayList<Entry> entries;
14 14
 
15
-    public Table() {
15
+    public Table()
16
+    {
17
+        this.entries = new ArrayList();
16 18
     }
19
+
20
+    public Object get(Object key)
21
+    {
22
+        for (int i = 0; i < entries.size(); i ++)
23
+        {
24
+            if (entries.get(i).getKey().equals(key))
25
+            {
26
+                return entries.get(i).getValue();
27
+            }
28
+        }
29
+        return null;
30
+    }
31
+
32
+    public void put(K key, V value)
33
+    {
34
+        for (int i = 0; i < entries.size(); i++)
35
+        {
36
+            if(entries.get(i).getKey().equals(key))
37
+            {
38
+                entries.set(i, new Entry<>(key, value));
39
+                return;
40
+            }
41
+        }
42
+
43
+        entries.add(new Entry<>(key, value));
44
+    }
45
+
46
+    public void remove(Object key)
47
+    {
48
+        for (int i = 0; i < entries.size(); i++)
49
+        {
50
+            entries.remove(i);
51
+        }
52
+    }
53
+
54
+
55
+
17 56
 }

+ 76
- 0
src/main/java/TableNested/TableNested.java Dosyayı Görüntüle

@@ -1,6 +1,7 @@
1 1
 package TableNested;
2 2
 
3 3
 import java.util.ArrayList;
4
+import java.util.Arrays;
4 5
 
5 6
 /**
6 7
  * All you need to do for this microlab is take the Table and Entry from the last one and make Entry a nested class.
@@ -8,4 +9,79 @@ import java.util.ArrayList;
8 9
  */
9 10
 public class TableNested<K, V> {
10 11
 
12
+    //field
13
+    private ArrayList<Entry> entries;
14
+
15
+    //contructor
16
+    public TableNested()
17
+    {
18
+        this.entries = new ArrayList<>();
19
+    }
20
+
21
+    //PUT, GET, REMOVE methods
22
+
23
+    public void put(K key, V value)
24
+    {
25
+
26
+
27
+        for (int i = 0; i < entries.size(); i++)
28
+        {
29
+            if (entries.get(i).getKey().equals(key))
30
+            {
31
+                entries.set(i, new Entry<>(key, value));
32
+                return;
33
+            }
34
+
35
+        }
36
+
37
+        entries.add(new Entry<>(key, value));
38
+
39
+    }
40
+
41
+    public Object get(Object key)
42
+    {
43
+        for (Entry entry : entries)
44
+        {
45
+            if (entry.getKey().equals(key)){
46
+                return entry.getValue();
47
+            }
48
+        }
49
+        return null;
50
+    }
51
+
52
+    public void remove(Object key)
53
+    {
54
+        for (int i = 0; i < entries.size(); i++)
55
+        {
56
+            entries.remove(i);
57
+        }
58
+
59
+    }
60
+
61
+
62
+
63
+    //Nested Class
64
+    private class Entry<K, V>
65
+    {
66
+        private K key;
67
+        private V value;
68
+
69
+
70
+        public Entry (K key, V value)
71
+        {
72
+            this.key = key;
73
+            this.value = value;
74
+        }
75
+
76
+        public K getKey() {
77
+            return key;
78
+        }
79
+
80
+        public V getValue(){
81
+            return value;
82
+        }
83
+    }
84
+
85
+
86
+
11 87
 }

+ 41
- 41
src/test/java/StackArray/GenericStackTest.java Dosyayı Görüntüle

@@ -1,41 +1,41 @@
1
-//package StackArray;
2
-//
3
-//import org.junit.Assert;
4
-//import org.junit.Test;
5
-//
6
-//public class GenericStackTest {
7
-//    @Test
8
-//    public void testPushingGrowsTheStack() throws Exception {
9
-//        // Given an empty stack
10
-//        GenericStack<String> stack = new GenericStack<>();
11
-//
12
-//        // Assert that it is empty.
13
-//        Assert.assertEquals(true, stack.isEmpty());
14
-//        // When we push something onto the stack
15
-//        stack.push("foobar");
16
-//        // Then it shouldn't be empty
17
-//        Assert.assertEquals(false, stack.isEmpty());
18
-//    }
19
-//
20
-//    @Test
21
-//    public void testPushingAndPoppingOrder() throws Exception {
22
-//        // Given an empty stack
23
-//        GenericStack<String> stack = new GenericStack<>();
24
-//        // When we push two elements on it
25
-//        stack.push("foo");
26
-//        stack.push("bar");
27
-//        // Then we should see them returned in the correct order
28
-//        Assert.assertEquals("bar", stack.pop());
29
-//        Assert.assertEquals("foo", stack.pop());
30
-//    }
31
-//
32
-//    @Test(expected = IndexOutOfBoundsException.class)
33
-//    public void testPopFirst() throws Exception {
34
-//        // Given an empty stack
35
-//        GenericStack<String> stack = new GenericStack<>();
36
-//        // When it's popped
37
-//        stack.pop();
38
-//        // Then we should get an exception
39
-//    }
40
-//
41
-//}
1
+package StackArray;
2
+
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+
6
+public class GenericStackTest {
7
+    @Test
8
+    public void testPushingGrowsTheStack() throws Exception {
9
+        // Given an empty stack
10
+        GenericStack<String> stack = new GenericStack<>();
11
+
12
+        // Assert that it is empty.
13
+        Assert.assertEquals(true, stack.isEmpty());
14
+        // When we push something onto the stack
15
+        stack.push("foobar");
16
+        // Then it shouldn't be empty
17
+        Assert.assertEquals(false, stack.isEmpty());
18
+    }
19
+
20
+    @Test
21
+    public void testPushingAndPoppingOrder() throws Exception {
22
+        // Given an empty stack
23
+        GenericStack<String> stack = new GenericStack<>();
24
+        // When we push two elements on it
25
+        stack.push("foo");
26
+        stack.push("bar");
27
+        // Then we should see them returned in the correct order
28
+        Assert.assertEquals("bar", stack.pop());
29
+        Assert.assertEquals("foo", stack.pop());
30
+    }
31
+
32
+    @Test(expected = IndexOutOfBoundsException.class)
33
+    public void testPopFirst() throws Exception {
34
+        // Given an empty stack
35
+        GenericStack<String> stack = new GenericStack<>();
36
+        // When it's popped
37
+        stack.pop();
38
+        // Then we should get an exception
39
+    }
40
+
41
+}

+ 39
- 39
src/test/java/StackArray/ObjectStackTest.java Dosyayı Görüntüle

@@ -1,39 +1,39 @@
1
-//package StackArray;
2
-//
3
-//import org.junit.Assert;
4
-//import org.junit.Test;
5
-//
6
-//public class ObjectStackTest {
7
-//    @Test
8
-//    public void testPushingGrowsTheStack() throws Exception {
9
-//        // Given an empty stack
10
-//        ObjectStack<String> stack = new ObjectStack<>();
11
-//        // Assert that it is empty.
12
-//        Assert.assertEquals(true, stack.isEmpty());
13
-//        // When we push something onto the stack
14
-//        stack.push("foobar");
15
-//        // Then it shouldn't be empty
16
-//        Assert.assertEquals(false, stack.isEmpty());
17
-//    }
18
-//
19
-//    @Test
20
-//    public void testPushingAndPoppingOrder() throws Exception {
21
-//        // Given an empty stack
22
-//        ObjectStack<String> stack = new ObjectStack<>();
23
-//        // When we push two elements on it
24
-//        stack.push("foo");
25
-//        stack.push("bar");
26
-//        // Then we should see them returned in the correct order
27
-//        Assert.assertEquals("bar", stack.pop());
28
-//        Assert.assertEquals("foo", stack.pop());
29
-//    }
30
-//
31
-//    @Test(expected = IndexOutOfBoundsException.class)
32
-//    public void testPopFirst() throws Exception {
33
-//        // Given an empty stack
34
-//        ObjectStack<String> stack = new ObjectStack<>();
35
-//        // When it's popped
36
-//        stack.pop();
37
-//        // Then we should get an exception
38
-//    }
39
-//}
1
+package StackArray;
2
+
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+
6
+public class ObjectStackTest {
7
+    @Test
8
+    public void testPushingGrowsTheStack() throws Exception {
9
+        // Given an empty stack
10
+        ObjectStack<String> stack = new ObjectStack<>();
11
+        // Assert that it is empty.
12
+        Assert.assertEquals(true, stack.isEmpty());
13
+        // When we push something onto the stack
14
+        stack.push("foobar");
15
+        // Then it shouldn't be empty
16
+        Assert.assertEquals(false, stack.isEmpty());
17
+    }
18
+
19
+    @Test
20
+    public void testPushingAndPoppingOrder() throws Exception {
21
+        // Given an empty stack
22
+        ObjectStack<String> stack = new ObjectStack<>();
23
+        // When we push two elements on it
24
+        stack.push("foo");
25
+        stack.push("bar");
26
+        // Then we should see them returned in the correct order
27
+        Assert.assertEquals("bar", stack.pop());
28
+        Assert.assertEquals("foo", stack.pop());
29
+    }
30
+
31
+    @Test(expected = IndexOutOfBoundsException.class)
32
+    public void testPopFirst() throws Exception {
33
+        // Given an empty stack
34
+        ObjectStack<String> stack = new ObjectStack<>();
35
+        // When it's popped
36
+        stack.pop();
37
+        // Then we should get an exception
38
+    }
39
+}

+ 45
- 45
src/test/java/StackArrayList/StackTest.java Dosyayı Görüntüle

@@ -1,45 +1,45 @@
1
-//package StackArrayList;
2
-//
3
-//import org.junit.Test;
4
-//
5
-//import org.junit.Assert;
6
-//
7
-//public class StackTest {
8
-//    @Test
9
-//    public void testEmptyStackStopsBeingEmptyWhenAnItemIsAdded() throws Exception {
10
-//        // Given an empty stack
11
-//        Stack<String> stack = new Stack<>();
12
-//        // Assert that it starts empty
13
-//        Assert.assertEquals(true, stack.isEmpty());
14
-//        // When an element gets pushed
15
-//        stack.push("foobar");
16
-//        // Then the stack should not be empty.
17
-//        Assert.assertEquals(false, stack.isEmpty());
18
-//    }
19
-//
20
-//    @Test
21
-//    public void testTwoItemsPushedComeOutInCorrectOrder() throws Exception {
22
-//        // Given an empty stack
23
-//        Stack<String> stack = new Stack<>();
24
-//
25
-//        //When two items are pushed
26
-//        stack.push("foo");
27
-//        stack.push("bar");
28
-//
29
-//        // Then they should come off in reverse order.
30
-//        Assert.assertEquals("bar", stack.pop());
31
-//        Assert.assertEquals("foo", stack.pop());
32
-//
33
-//        // And then the stack should be empty
34
-//        Assert.assertEquals(true, stack.isEmpty());
35
-//    }
36
-//
37
-//    @Test(expected = IndexOutOfBoundsException.class)
38
-//    public void testPopFirst() throws Exception {
39
-//        // Given an empty stack
40
-//        Stack<String> stack = new Stack<>();
41
-//        // Then it is popped
42
-//        stack.pop();
43
-//        // We should get an exception
44
-//    }
45
-//}
1
+package StackArrayList;
2
+
3
+import org.junit.Test;
4
+
5
+import org.junit.Assert;
6
+
7
+public class StackTest {
8
+    @Test
9
+    public void testEmptyStackStopsBeingEmptyWhenAnItemIsAdded() throws Exception {
10
+        // Given an empty stack
11
+        Stack<String> stack = new Stack<>();
12
+        // Assert that it starts empty
13
+        Assert.assertEquals(true, stack.isEmpty());
14
+        // When an element gets pushed
15
+        stack.push("foobar");
16
+        // Then the stack should not be empty.
17
+        Assert.assertEquals(false, stack.isEmpty());
18
+    }
19
+
20
+    @Test
21
+    public void testTwoItemsPushedComeOutInCorrectOrder() throws Exception {
22
+        // Given an empty stack
23
+        Stack<String> stack = new Stack<>();
24
+
25
+        //When two items are pushed
26
+        stack.push("foo");
27
+        stack.push("bar");
28
+
29
+        // Then they should come off in reverse order.
30
+        Assert.assertEquals("bar", stack.pop());
31
+        Assert.assertEquals("foo", stack.pop());
32
+
33
+        // And then the stack should be empty
34
+        Assert.assertEquals(true, stack.isEmpty());
35
+    }
36
+
37
+    @Test(expected = IndexOutOfBoundsException.class)
38
+    public void testPopFirst() throws Exception {
39
+        // Given an empty stack
40
+        Stack<String> stack = new Stack<>();
41
+        // Then it is popped
42
+        stack.pop();
43
+        // We should get an exception
44
+    }
45
+}

+ 50
- 50
src/test/java/Table/TableTest.java Dosyayı Görüntüle

@@ -1,50 +1,50 @@
1
-//package Table;
2
-//
3
-//import org.junit.Assert;
4
-//import org.junit.Test;
5
-//
6
-//public class TableTest {
7
-//    @Test
8
-//    public void testGetWithoutAnItemReturnsNull() throws Exception {
9
-//        // Given an empty table
10
-//        Table<String, Integer> table = new Table<String, Integer>();
11
-//        // When we try and get an item then it returns null
12
-//        Assert.assertEquals(table.get("foo"), null);
13
-//    }
14
-//
15
-//    @Test
16
-//    public void testPutAnItemReturnsAndDoesNotDelete() throws Exception {
17
-//        //Given an empty table
18
-//        Table<String, Integer> table = new Table<String, Integer>();
19
-//        // When we put an item in it
20
-//        table.put("foo", 1);
21
-//        // Then we should be able to get it's value
22
-//        Assert.assertEquals(table.get("foo"), new Integer(1));
23
-//        // And then we should be able to get it again as it wasn't removed
24
-//        Assert.assertEquals(table.get("foo"), new Integer(1));
25
-//    }
26
-//
27
-//    @Test
28
-//    public void testOverwritingAnItem() throws Exception {
29
-//        //Given an empty table
30
-//        Table<String, Integer> table = new Table<String, Integer>();
31
-//        // When we put an item in it
32
-//        table.put("foo", 1);
33
-//        // And we put a new value with the same key
34
-//        table.put("foo", 2);
35
-//        // Then we should get back the new value
36
-//        Assert.assertEquals(table.get("foo"), new Integer(2));
37
-//    }
38
-//
39
-//    @Test
40
-//    public void testRemoveAnItem() throws Exception {
41
-//        //Given an empty table
42
-//        Table<String, Integer> table = new Table<String, Integer>();
43
-//        // When we put an item in it
44
-//        table.put("foo", 1);
45
-//        // And we remove that item
46
-//        table.remove("foo");
47
-//        // Then we should get back null for that balue
48
-//        Assert.assertEquals(table.get("foo"), null);
49
-//    }
50
-//}
1
+package Table;
2
+
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+
6
+public class TableTest {
7
+    @Test
8
+    public void testGetWithoutAnItemReturnsNull() throws Exception {
9
+        // Given an empty table
10
+        Table<String, Integer> table = new Table<String, Integer>();
11
+        // When we try and get an item then it returns null
12
+        Assert.assertEquals(table.get("foo"), null);
13
+    }
14
+
15
+    @Test
16
+    public void testPutAnItemReturnsAndDoesNotDelete() throws Exception {
17
+        //Given an empty table
18
+        Table<String, Integer> table = new Table<String, Integer>();
19
+        // When we put an item in it
20
+        table.put("foo", 1);
21
+        // Then we should be able to get it's value
22
+        Assert.assertEquals(table.get("foo"), new Integer(1));
23
+        // And then we should be able to get it again as it wasn't removed
24
+        Assert.assertEquals(table.get("foo"), new Integer(1));
25
+    }
26
+
27
+    @Test
28
+    public void testOverwritingAnItem() throws Exception {
29
+        //Given an empty table
30
+        Table<String, Integer> table = new Table<String, Integer>();
31
+        // When we put an item in it
32
+        table.put("foo", 1);
33
+        // And we put a new value with the same key
34
+        table.put("foo", 2);
35
+        // Then we should get back the new value
36
+        Assert.assertEquals(table.get("foo"), new Integer(2));
37
+    }
38
+
39
+    @Test
40
+    public void testRemoveAnItem() throws Exception {
41
+        //Given an empty table
42
+        Table<String, Integer> table = new Table<String, Integer>();
43
+        // When we put an item in it
44
+        table.put("foo", 1);
45
+        // And we remove that item
46
+        table.remove("foo");
47
+        // Then we should get back null for that balue
48
+        Assert.assertEquals(table.get("foo"), null);
49
+    }
50
+}

+ 50
- 50
src/test/java/TableNested/TableNestedTest.java Dosyayı Görüntüle

@@ -1,50 +1,50 @@
1
-//package TableNested;
2
-//
3
-//import org.junit.Assert;
4
-//import org.junit.Test;
5
-//
6
-//public class TableNestedTest {
7
-//    @Test
8
-//    public void testGetWithoutAnItemReturnsNull() throws Exception {
9
-//        // Given an empty table
10
-//        TableNested<String, Integer> table = new TableNested<String, Integer>();
11
-//        // When we try and get an item then it returns null
12
-//        Assert.assertEquals(table.get("foo"), null);
13
-//    }
14
-//
15
-//    @Test
16
-//    public void testPutAnItemReturnsAndDoesNotDelete() throws Exception {
17
-//        //Given an empty table
18
-//        TableNested<String, Integer> table = new TableNested<String, Integer>();
19
-//        // When we put an item in it
20
-//        table.put("foo", 1);
21
-//        // Then we should be able to get it's value
22
-//        Assert.assertEquals(table.get("foo"), new Integer(1));
23
-//        // And then we should be able to get it again as it wasn't removed
24
-//        Assert.assertEquals(table.get("foo"), new Integer(1));
25
-//    }
26
-//
27
-//    @Test
28
-//    public void testOverwritingAnItem() throws Exception {
29
-//        //Given an empty table
30
-//        TableNested<String, Integer> table = new TableNested<String, Integer>();
31
-//        // When we put an item in it
32
-//        table.put("foo", 1);
33
-//        // And we put a new value with the same key
34
-//        table.put("foo", 2);
35
-//        // Then we should get back the new value
36
-//        Assert.assertEquals(table.get("foo"), new Integer(2));
37
-//    }
38
-//
39
-//    @Test
40
-//    public void testRemoveAnItem() throws Exception {
41
-//        //Given an empty table
42
-//        TableNested<String, Integer> table = new TableNested<String, Integer>();
43
-//        // When we put an item in it
44
-//        table.put("foo", 1);
45
-//        // And we remove that item
46
-//        table.remove("foo");
47
-//        // Then we should get back null for that balue
48
-//        Assert.assertEquals(table.get("foo"), null);
49
-//    }
50
-//}
1
+package TableNested;
2
+
3
+import org.junit.Assert;
4
+import org.junit.Test;
5
+
6
+public class TableNestedTest {
7
+    @Test
8
+    public void testGetWithoutAnItemReturnsNull() throws Exception {
9
+        // Given an empty table
10
+        TableNested<String, Integer> table = new TableNested<String, Integer>();
11
+        // When we try and get an item then it returns null
12
+        Assert.assertEquals(table.get("foo"), null);
13
+    }
14
+
15
+    @Test
16
+    public void testPutAnItemReturnsAndDoesNotDelete() throws Exception {
17
+        //Given an empty table
18
+        TableNested<String, Integer> table = new TableNested<String, Integer>();
19
+        // When we put an item in it
20
+        table.put("foo", 1);
21
+        // Then we should be able to get it's value
22
+        Assert.assertEquals(table.get("foo"), new Integer(1));
23
+        // And then we should be able to get it again as it wasn't removed
24
+        Assert.assertEquals(table.get("foo"), new Integer(1));
25
+    }
26
+
27
+    @Test
28
+    public void testOverwritingAnItem() throws Exception {
29
+        //Given an empty table
30
+        TableNested<String, Integer> table = new TableNested<String, Integer>();
31
+        // When we put an item in it
32
+        table.put("foo", 1);
33
+        // And we put a new value with the same key
34
+        table.put("foo", 2);
35
+        // Then we should get back the new value
36
+        Assert.assertEquals(table.get("foo"), new Integer(2));
37
+    }
38
+
39
+    @Test
40
+    public void testRemoveAnItem() throws Exception {
41
+        //Given an empty table
42
+        TableNested<String, Integer> table = new TableNested<String, Integer>();
43
+        // When we put an item in it
44
+        table.put("foo", 1);
45
+        // And we remove that item
46
+        table.remove("foo");
47
+        // Then we should get back null for that balue
48
+        Assert.assertEquals(table.get("foo"), null);
49
+    }
50
+}