Copies all elements from the iterable collection of originals to the collection provided. @param the collection of strings @param token String to search for @param originals An iterable collection of strings to filter. @param collection The collection to add matches to @return the collection pr
(@NotNull final String token, @NotNull final Iterable<String> originals, @NotNull final T collection)
| 24 | * <b>Note: the collection may be modified before this is thrown</b> |
| 25 | */ |
| 26 | @NotNull |
| 27 | public static <T extends Collection<? super String>> T copyPartialMatches(@NotNull final String token, @NotNull final Iterable<String> originals, @NotNull final T collection) throws UnsupportedOperationException, IllegalArgumentException { |
| 28 | Validate.notNull(token, "Search token cannot be null"); |
| 29 | Validate.notNull(collection, "Collection cannot be null"); |
| 30 | Validate.notNull(originals, "Originals cannot be null"); |
| 31 | |
| 32 | for (String string : originals) { |
| 33 | if (startsWithIgnoreCase(string, token)) { |
| 34 | collection.add(string); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | return collection; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * This method uses a region to check case-insensitive equality. This |
no test coverage detected