mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-23 04:20:16 +08:00
Parameterize references to generic types. (#5078)
* chore: remove unused imports * fix: parameterize references to generic types --------- Co-authored-by: vil02 <65706193+vil02@users.noreply.github.com>
This commit is contained in:
@ -51,13 +51,13 @@ class WordLadder {
|
||||
* if the endword is there. Otherwise, will return the length as 0.
|
||||
*/
|
||||
public static int ladderLength(String beginWord, String endWord, List<String> wordList) {
|
||||
HashSet<String> set = new HashSet(wordList);
|
||||
HashSet<String> set = new HashSet<>(wordList);
|
||||
|
||||
if (!set.contains(endWord)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Queue<String> queue = new LinkedList();
|
||||
Queue<String> queue = new LinkedList<>();
|
||||
queue.offer(beginWord);
|
||||
int level = 1;
|
||||
|
||||
|
Reference in New Issue
Block a user