[GitHub] commons-text pull request #57: TEXT-98: Remove isDelimiter and use HashSets ...
Github user asfgit closed the pull request at: https://github.com/apache/commons-text/pull/57 --- 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
[GitHub] commons-text pull request #57: TEXT-98: Remove isDelimiter and use HashSets ...
Github user ameyjadiye commented on a diff in the pull request: https://github.com/apache/commons-text/pull/57#discussion_r129102634 --- 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. + * + * 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. + * * - * @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 */ -public static boolean isDelimiter(final char ch, 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
[GitHub] commons-text pull request #57: TEXT-98: Remove isDelimiter and use HashSets ...
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. + * + * 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. + * * - * @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 */ -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 generateDelimiterSet(final char[] delimiters) { +Set 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
[GitHub] commons-text pull request #57: TEXT-98: Remove isDelimiter and use HashSets ...
GitHub user arunvinudss opened a pull request: https://github.com/apache/commons-text/pull/57 TEXT-98: Remove isDelimiter and use HashSets for delimiter checks You can merge this pull request into a Git repository by running: $ git pull https://github.com/arunvinudss/commons-text TEXT-98 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-text/pull/57.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #57 commit eabb18efa39b1fbebf66d46282d6abc3f9b2c7aa Author: Arun Vinud Date: 2017-07-23T14:57:37Z Remove isDelimiter and using HashSets for delimiter checks --- 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