@Test public void testLoad() { WildcardMatchLoader loader = new WildcardMatchLoader(Arrays.asList("rune*", "Abyssal whip")); assertTrue(loader.load("rune pouch")); assertTrue(loader.load("Rune pouch")); assertFalse(loader.load("Adamant dagger")); assertTrue(loader.load("Runeite Ore")); assertTrue(loader.load("Abyssal whip")); assertFalse(loader.load("Abyssal dagger")); }
@Override public Boolean load(@Nonnull final String key) { if (Strings.isNullOrEmpty(key)) { return false; } final String filteredName = key.trim(); for (final String filter : nameFilters) { if (WildcardMatcher.matches(filter, filteredName)) { return true; } } return false; }
WildcardMatchLoader extends CacheLoader<String, Boolean> { @Override public Boolean load(@Nonnull final String key) { if (Strings.isNullOrEmpty(key)) { return false; } final String filteredName = key.trim(); for (final String filter : nameFilters) { if (WildcardMatcher.matches(filter, filteredName)) { return true; } } return false; } }
WildcardMatchLoader extends CacheLoader<String, Boolean> { @Override public Boolean load(@Nonnull final String key) { if (Strings.isNullOrEmpty(key)) { return false; } final String filteredName = key.trim(); for (final String filter : nameFilters) { if (WildcardMatcher.matches(filter, filteredName)) { return true; } } return false; } WildcardMatchLoader(List<String> nameFilters); }
WildcardMatchLoader extends CacheLoader<String, Boolean> { @Override public Boolean load(@Nonnull final String key) { if (Strings.isNullOrEmpty(key)) { return false; } final String filteredName = key.trim(); for (final String filter : nameFilters) { if (WildcardMatcher.matches(filter, filteredName)) { return true; } } return false; } WildcardMatchLoader(List<String> nameFilters); @Override Boolean load(@Nonnull final String key); }
WildcardMatchLoader extends CacheLoader<String, Boolean> { @Override public Boolean load(@Nonnull final String key) { if (Strings.isNullOrEmpty(key)) { return false; } final String filteredName = key.trim(); for (final String filter : nameFilters) { if (WildcardMatcher.matches(filter, filteredName)) { return true; } } return false; } WildcardMatchLoader(List<String> nameFilters); @Override Boolean load(@Nonnull final String key);  }