diff --git a/Antlr4.Runtime/Misc/Utils.cs b/Antlr4.Runtime/Misc/Utils.cs index 45d6e1ee3..77cdb99ef 100644 --- a/Antlr4.Runtime/Misc/Utils.cs +++ b/Antlr4.Runtime/Misc/Utils.cs @@ -27,6 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Collections.Generic; using System.Text; using Antlr4.Runtime.Misc; @@ -103,7 +104,7 @@ namespace Antlr4.Runtime.Misc return buf.ToString(); } - public static void RemoveAll(IList list, IPredicate<_T1> predicate) + public static void RemoveAll(IList list, Predicate<_T1> predicate) { int j = 0; for (int i = 0; i < list.Count; i++) @@ -123,23 +124,5 @@ namespace Antlr4.Runtime.Misc list.SubList(j, list.Count).Clear(); } } - - public static void RemoveAll(IEnumerable iterable, IPredicate<_T1> predicate - ) - { - if (iterable is IList) - { - RemoveAll((IList)iterable, predicate); - return; - } - for (IEnumerator iterator = iterable.GetEnumerator(); iterator.HasNext(); ) - { - T item = iterator.Next(); - if (predicate.Eval(item)) - { - iterator.Remove(); - } - } - } } } diff --git a/reference/antlr4 b/reference/antlr4 index 9209ffea8..55e095830 160000 --- a/reference/antlr4 +++ b/reference/antlr4 @@ -1 +1 @@ -Subproject commit 9209ffea852fc94a198496bdb87babd0def4148e +Subproject commit 55e0958300f33236e916623077fd356fc6914b6d diff --git a/reference/sharpen-all-options.txt b/reference/sharpen-all-options.txt index d4eec06bf..7bda0aaf0 100644 --- a/reference/sharpen-all-options.txt +++ b/reference/sharpen-all-options.txt @@ -193,6 +193,9 @@ -methodMapping org.antlr.v4.runtime.misc.EqualityComparator.hashCode GetHashCode -typeMapping org.antlr.v4.runtime.misc.AbstractEqualityComparator<> System.Collections.Generic.EqualityComparer -typeMapping org.antlr.v4.runtime.misc.FlexibleHashMap<,> System.Collections.Generic.Dictionary +-typeMapping org.antlr.v4.runtime.misc.Predicate<> System.Predicate +-typeMapping org.antlr.v4.runtime.misc.Func0<> System.Func +-typeMapping org.antlr.v4.runtime.misc.Func1<,> System.Func -typeMapping org.antlr.v4.runtime.misc.Tuple System.Tuple -typeMapping org.antlr.v4.runtime.misc.Tuple2<,> System.Tuple