first time in my life i found a use case for HashSet
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
{
|
||||
class EquationManager
|
||||
{
|
||||
private static readonly HashSet<string> _operators = new() { "+", "-", "*", "/", "^", "√" };
|
||||
private ReverseNotationSolver reverseNotationSolver = new();
|
||||
|
||||
List<Token> equation = new();
|
||||
@@ -177,7 +178,7 @@
|
||||
private bool IsOperator()
|
||||
{
|
||||
if (equation.Count == 0) return false;
|
||||
return new[] { "+", "-", "*", "/", "^", "√" }.Contains(equation.Last().value);
|
||||
return _operators.Contains(equation.Last().value);
|
||||
}
|
||||
|
||||
private bool IsOpen()
|
||||
|
||||
Reference in New Issue
Block a user