Github user ameyjadiye commented on a diff in the pull request: https://github.com/apache/commons-text/pull/57#discussion_r129102692 --- Diff: src/main/java/org/apache/commons/text/WordUtils.java --- @@ -747,45 +750,29 @@ public static boolean containsAllWords(final CharSequence word, final CharSequen return true; } - //----------------------------------------------------------------------- + // ----------------------------------------------------------------------- /** - * Is the character a delimiter. + * <p> + * Converts an array of delimiters to a hash set of code points. Code point of space(32) is added as the default + * value if delimiters is null. The generated hash set provides O(1) lookup time. + * </p> * - * @param ch the character to check - * @param delimiters the delimiters - * @return true if it is a delimiter + * @param delimiters set of characters to determine capitalization, null means whitespace + * @return Set<Integer> */ - public static boolean isDelimiter(final char ch, final char[] delimiters) { - if (delimiters == null) { - return Character.isWhitespace(ch); - } - for (final char delimiter : delimiters) { - if (ch == delimiter) { - return true; + private static Set<Integer> generateDelimiterSet(final char[] delimiters) { + Set<Integer> delimiterHashSet = new HashSet<>(); + if (delimiters == null || delimiters.length == 0) { + if (delimiters == null) { + delimiterHashSet.add(Character.codePointAt(new char[] {' '}, 0)); } + return delimiterHashSet; } - return false; - } - //----------------------------------------------------------------------- - /** - * Is the codePoint a delimiter. - * - * @param codePoint the codePint to check - * @param delimiters the delimiters - * @return true if it is a delimiter - */ - public static boolean isDelimiter(final int codePoint, final char[] delimiters) { --- End diff -- Rather removing we should keep this method.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org