Skip to content

Commit 0899f61

Browse files
committed
don't want to confuse reader with ? syntax even if more accurate
1 parent 59a6e35 commit 0899f61

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

CCSPiJ/src/chapter2/GenericSearch.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
public class GenericSearch {
3434

35-
public static <T extends Comparable<? super T>> boolean linearContains(List<T> list, T key) {
35+
public static <T extends Comparable<T>> boolean linearContains(List<T> list, T key) {
3636
for (T item : list) {
3737
if (item.compareTo(key) == 0) {
3838
return true; // found a match
@@ -42,7 +42,7 @@ public static <T extends Comparable<? super T>> boolean linearContains(List<T> l
4242
}
4343

4444
// assumes *list* is already sorted
45-
public static <T extends Comparable<? super T>> boolean binaryContains(List<T> list, T key) {
45+
public static <T extends Comparable<T>> boolean binaryContains(List<T> list, T key) {
4646
int low = 0;
4747
int high = list.size() - 1;
4848
while (low <= high) { // while there is still a search space
@@ -117,7 +117,7 @@ public static <T> Node<T> dfs(T initial, Predicate<T> goalTest,
117117
}
118118

119119
public static <T> List<T> nodeToPath(Node<T> node) {
120-
ArrayList<T> path = new ArrayList<>();
120+
List<T> path = new ArrayList<>();
121121
path.add(node.state);
122122
// work backwards from end to front
123123
while (node.parent != null) {

0 commit comments

Comments
 (0)