1 package com.android.launcher3.util; 2 3 import java.util.Set; 4 5 /** 6 * Abstract class to filter a set of strings. 7 */ 8 public abstract class StringFilter { 9 StringFilter()10 private StringFilter() { } 11 matches(String str)12 public abstract boolean matches(String str); 13 matchesAll()14 public static StringFilter matchesAll() { 15 return new StringFilter() { 16 @Override 17 public boolean matches(String str) { 18 return true; 19 } 20 }; 21 } 22 23 public static StringFilter of(final Set<String> validEntries) { 24 return new StringFilter() { 25 @Override 26 public boolean matches(String str) { 27 return validEntries.contains(str); 28 } 29 }; 30 } 31 } 32