MCPcopy Create free account
hub / github.com/Teneted/Tenet / copyPartialMatches

Method copyPartialMatches

src/main/java/org/bukkit/util/StringUtil.java:26–39  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

tabCompleteMethod · 0.95

Calls 2

startsWithIgnoreCaseMethod · 0.95
addMethod · 0.65

Tested by

no test coverage detected