Skip to content
Snippets Groups Projects
Commit ab289774 authored by Nathan Lipiarski's avatar Nathan Lipiarski
Browse files

Improving generics with respect to NGrams

parent 85790ef2
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@ import datastructures.worklists.ArrayStack;
* BinarySearchTree implements the ComparableDictionary interface using a binary
* search tree. Notice that the key type must be Comparable.
*/
public class BinarySearchTree<K extends Comparable<K>, V>
public class BinarySearchTree<K extends Comparable<? super K>, V>
extends ComparableDictionary<K, V> {
// The root of the BST. Root is null if and only if the tree is empty.
protected BSTNode root;
......
......@@ -10,6 +10,6 @@ package cse332.interfaces.misc;
*
* @author Adam Blank
*/
public abstract class ComparableDictionary<K extends Comparable<K>, V>
public abstract class ComparableDictionary<K extends Comparable<? super K>, V>
extends DeletelessDictionary<K, V> {
}
......@@ -28,6 +28,6 @@ import cse332.datastructures.trees.BinarySearchTree;
* 6. Do NOT override the toString method. It is used for grading.
*/
public class AVLTree<K extends Comparable<K>, V> extends BinarySearchTree<K, V> {
public class AVLTree<K extends Comparable<? super K>, V> extends BinarySearchTree<K, V> {
// TODO: Implement me!
}
package tests.gitlab.ckpt1;
import cse332.datastructures.containers.Item;
import cse332.datastructures.trees.BinarySearchTree;
import cse332.types.NGram;
import org.junit.Test;
import p2.wordsuggestor.NGramToNextChoicesMap;
import java.util.Arrays;
import java.util.Comparator;
import java.util.TreeMap;
import java.util.Map;
import java.util.function.Supplier;
import java.util.TreeMap;
import cse332.datastructures.containers.Item;
import cse332.interfaces.misc.Dictionary;
import cse332.types.AlphabeticString;
import cse332.types.NGram;
import cse332.datastructures.trees.BinarySearchTree;
import p2.wordsuggestor.NGramToNextChoicesMap;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
public class NGramToNextChoicesMapTests {
private NGramToNextChoicesMap init() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment