From 78e288d0b728f32493857c70ebda916c66aad103 Mon Sep 17 00:00:00 2001 From: Ben Yu Date: Sat, 19 Sep 2020 10:52:38 -0700 Subject: [PATCH] Remove previous deprecated methods; --- .../java/com/google/mu/util/Substring.java | 12 --- .../google/mu/util/graph/CycleDetector.java | 76 ------------------- .../google/mu/util/stream/BiIteration.java | 6 -- .../com/google/mu/util/stream/Iteration.java | 6 -- .../google/mu/util/stream/MoreStreams.java | 11 --- 5 files changed, 111 deletions(-) delete mode 100644 mug/src/main/java/com/google/mu/util/graph/CycleDetector.java diff --git a/mug/src/main/java/com/google/mu/util/Substring.java b/mug/src/main/java/com/google/mu/util/Substring.java index d40f21a65b..233c01284e 100644 --- a/mug/src/main/java/com/google/mu/util/Substring.java +++ b/mug/src/main/java/com/google/mu/util/Substring.java @@ -919,12 +919,6 @@ public String before() { return context.substring(0, startIndex); } - /** Use {@link #before} instead. */ - @Deprecated - public String getBefore() { - return before(); - } - /** * Returns the part of the original string before the matched substring. * @@ -941,12 +935,6 @@ public String after() { return context.substring(endIndex); } - /** Use {@link #after} instead. */ - @Deprecated - public String getAfter() { - return after(); - } - /** Return the full string being matched against. */ public String fullString() { return context; diff --git a/mug/src/main/java/com/google/mu/util/graph/CycleDetector.java b/mug/src/main/java/com/google/mu/util/graph/CycleDetector.java deleted file mode 100644 index 16d27373bc..0000000000 --- a/mug/src/main/java/com/google/mu/util/graph/CycleDetector.java +++ /dev/null @@ -1,76 +0,0 @@ -/***************************************************************************** - * ------------------------------------------------------------------------- * - * Licensed under the Apache License, Version 2.0 (the "License"); * - * you may not use this file except in compliance with the License. * - * You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an "AS IS" BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - *****************************************************************************/ -package com.google.mu.util.graph; - -import static com.google.mu.util.graph.Walker.nonNullList; -import static java.util.Objects.requireNonNull; - -import java.util.Optional; -import java.util.function.Function; -import java.util.stream.Stream; - -/** - * @deprecated Use {@link GraphWalker#detectCycleFrom} instead. - */ -@Deprecated -public final class CycleDetector { - private final Function> findSuccessors; - - private CycleDetector(Function> findSuccessors) { - this.findSuccessors = requireNonNull(findSuccessors); - } - - /** - * Returns a {@code CycleDetector} for the graph topology as observed by the - * {@code findSuccessors} function. - */ - public static CycleDetector forGraph( - Function> findSuccessors) { - return new CycleDetector<>(findSuccessors); - } - - /** - * Walking from {@code startNodes}, detects if the graph has any cycle. - * - *

This method will hang if the given graph is infinite without cycle (the sequence of natural - * numbers for instance). - * - * @param startNodes the entry point nodes to start walking the graph. - * @return The stream of nodes starting from the first of {@code startNodes} that leads to a - * cycle, ending with nodes along a cyclic path. The last node will also be the starting - * point of the cycle. That is, if {@code A} and {@code B} form a cycle, the stream ends - * with {@code A -> B -> A}. If there is no cycle, {@link Optional#empty} is returned. - */ - @SafeVarargs - public final Optional> detectCycleFrom(N... startNodes) { - return detectCycleFrom(nonNullList(startNodes)); - } - - /** - * Walking from {@code startNodes}, detects if the graph has any cycle. - * - *

This method will hang if the given graph is infinite with no cycles (the sequence of natural - * numbers for instance). - * - * @param startNodes the entry point nodes to start walking the graph. - * @return The stream of nodes starting from the first of {@code startNodes} that leads to a - * cycle, ending with nodes along a cyclic path. The last node will also be the starting - * point of the cycle. That is, if {@code A} and {@code B} form a cycle, the stream ends - * with {@code A -> B -> A}. If there is no cycle, {@link Optional#empty} is returned. - */ - public Optional> detectCycleFrom(Iterable startNodes) { - return Walker.inGraph(findSuccessors).detectCycleFrom(startNodes); - } -} diff --git a/mug/src/main/java/com/google/mu/util/stream/BiIteration.java b/mug/src/main/java/com/google/mu/util/stream/BiIteration.java index bc1026f945..6e9a6a51b8 100644 --- a/mug/src/main/java/com/google/mu/util/stream/BiIteration.java +++ b/mug/src/main/java/com/google/mu/util/stream/BiIteration.java @@ -44,12 +44,6 @@ public final BiIteration yield(Continuation continuation) { return this; } - /** @deprecated Use {@link #iterate} instead. */ - @Deprecated - public final BiStream stream() { - return iterate(); - } - /** * Starts iteration over the {@link #yield yielded} pairs. * diff --git a/mug/src/main/java/com/google/mu/util/stream/Iteration.java b/mug/src/main/java/com/google/mu/util/stream/Iteration.java index be773cbcea..43828b3eba 100644 --- a/mug/src/main/java/com/google/mu/util/stream/Iteration.java +++ b/mug/src/main/java/com/google/mu/util/stream/Iteration.java @@ -251,12 +251,6 @@ public final Iteration yield( }); } - /** @deprecated Use {@link #iterate} instead. */ - @Deprecated - public final Stream stream() { - return iterate(); - } - /** * Starts iteration over the {@link #yield yielded} elements. * diff --git a/mug/src/main/java/com/google/mu/util/stream/MoreStreams.java b/mug/src/main/java/com/google/mu/util/stream/MoreStreams.java index c31eab360d..87ab448988 100644 --- a/mug/src/main/java/com/google/mu/util/stream/MoreStreams.java +++ b/mug/src/main/java/com/google/mu/util/stream/MoreStreams.java @@ -312,17 +312,6 @@ public static Stream indexesFrom(int firstIndex) { return IntStream.iterate(firstIndex, i -> i + 1).boxed(); } - /** - * @deprecated Use {@code whileNotNull(queue::poll)} in place of {@code - * whileNotEmpty(queue).map(Queue::remove)}, and {@code whileNotNull(stack::poll)} in place of - * {@code whileNotEmpty(stack).map(Deque::poll)}. - */ - @Deprecated - public static > Stream whileNotEmpty(C collection) { - requireNonNull(collection); - return whileNotNull(() -> collection.isEmpty() ? null : collection); - } - /** * Similar to {@link Stream#generate}, returns an infinite, sequential, unordered, and non-null * stream where each element is generated by the provided Supplier. The stream however will