public static List<String> parse(@Nullable String input, boolean escapeComma, boolean trim) {
    if (null == input || input.isEmpty()) {
      return Collections.emptyList();
    }

    Stream<String> tokenStream;
    if (escapeComma) {
      // Use regular expression to split on "," unless it is "\,"
      // Use a non-positive limit to apply the replacement as many times as possible and to ensure trailing empty
      // strings shall not be discarded
      tokenStream = Arrays.stream(input.split("(?<!\\\\),", -1))
          .map(s -> s.replace("\\,", ","));
    } else {
      tokenStream = Arrays.stream(input.split(","));
    }

    if (trim) {
      tokenStream = tokenStream.map(String::trim);
    }

    return tokenStream.collect(Collectors.toList());
  }
@Test
    public void testEscapeTrueTrimTrue() {
        String input = " \\,.\n\t()[]{}\"':=-_$\\?@&|#+/,:=[]$@&|#";
        List<String> expectedOutput = Arrays.asList(",.\n\t()[]{}\"':=-_$\\?@&|#+/", ":=[]$@&|#");
        Assert.assertEquals(CsvParser.parse(input, true, true), expectedOutput);
    }