Get rid of dependency on guava in DFS
This commit is contained in:
committed by
Alexander Udalov
parent
239ca9728d
commit
5ebbe0d772
@@ -16,14 +16,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.utils;
|
package org.jetbrains.jet.utils;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class DFS {
|
public class DFS {
|
||||||
public static <N, R> R dfs(@NotNull Collection<N> nodes, @NotNull Neighbors<N> neighbors, @NotNull Visited<N> visited, @NotNull NodeHandler<N, R> handler) {
|
public static <N, R> R dfs(@NotNull Collection<N> nodes, @NotNull Neighbors<N> neighbors, @NotNull Visited<N> visited, @NotNull NodeHandler<N, R> handler) {
|
||||||
@@ -114,7 +109,7 @@ public class DFS {
|
|||||||
private final Set<N> visited;
|
private final Set<N> visited;
|
||||||
|
|
||||||
public VisitedWithSet() {
|
public VisitedWithSet() {
|
||||||
this(Sets.<N>newHashSet());
|
this(new HashSet<N>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public VisitedWithSet(@NotNull Set<N> visited) {
|
public VisitedWithSet(@NotNull Set<N> visited) {
|
||||||
@@ -128,7 +123,7 @@ public class DFS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static abstract class NodeHandlerWithListResult<N, R> extends AbstractNodeHandler<N, List<R>> {
|
public static abstract class NodeHandlerWithListResult<N, R> extends AbstractNodeHandler<N, List<R>> {
|
||||||
protected final LinkedList<R> result = Lists.newLinkedList();
|
protected final LinkedList<R> result = new LinkedList<R>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<R> result() {
|
public List<R> result() {
|
||||||
|
|||||||
Reference in New Issue
Block a user