Package com.google.common.base
Class CharMatcher.ForPredicate
- java.lang.Object
-
- com.google.common.base.CharMatcher
-
- com.google.common.base.CharMatcher.ForPredicate
-
- All Implemented Interfaces:
Predicate<java.lang.Character>
,java.util.function.Predicate<java.lang.Character>
- Enclosing class:
- CharMatcher
private static final class CharMatcher.ForPredicate extends CharMatcher
Implementation ofCharMatcher.forPredicate(Predicate)
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.base.CharMatcher
CharMatcher.FastMatcher, CharMatcher.NamedFastMatcher, CharMatcher.NegatedFastMatcher, CharMatcher.Whitespace
-
-
Field Summary
Fields Modifier and Type Field Description private Predicate<? super java.lang.Character>
predicate
-
Fields inherited from class com.google.common.base.CharMatcher
ANY, ASCII, BREAKING_WHITESPACE, DIGIT, INVISIBLE, JAVA_DIGIT, JAVA_ISO_CONTROL, JAVA_LETTER, JAVA_LETTER_OR_DIGIT, JAVA_LOWER_CASE, JAVA_UPPER_CASE, NONE, SINGLE_WIDTH, WHITESPACE
-
-
Constructor Summary
Constructors Constructor Description ForPredicate(Predicate<? super java.lang.Character> predicate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
apply(java.lang.Character character)
Returns the result of applying this predicate toinput
(Java 8 users, see notes in the class documentation above).boolean
matches(char c)
Determines a true or false value for the given character.java.lang.String
toString()
Returns a string representation of thisCharMatcher
, such asCharMatcher.or(WHITESPACE, JAVA_DIGIT)
.-
Methods inherited from class com.google.common.base.CharMatcher
and, any, anyOf, ascii, breakingWhitespace, collapseFrom, countIn, digit, forPredicate, indexIn, indexIn, inRange, invisible, is, isNot, javaDigit, javaIsoControl, javaLetter, javaLetterOrDigit, javaLowerCase, javaUpperCase, lastIndexIn, matchesAllOf, matchesAnyOf, matchesNoneOf, negate, none, noneOf, or, precomputed, precomputedInternal, removeFrom, replaceFrom, replaceFrom, retainFrom, setBits, singleWidth, trimAndCollapseFrom, trimFrom, trimLeadingFrom, trimTrailingFrom, whitespace
-
-
-
-
Field Detail
-
predicate
private final Predicate<? super java.lang.Character> predicate
-
-
Constructor Detail
-
ForPredicate
ForPredicate(Predicate<? super java.lang.Character> predicate)
-
-
Method Detail
-
matches
public boolean matches(char c)
Description copied from class:CharMatcher
Determines a true or false value for the given character.- Specified by:
matches
in classCharMatcher
-
apply
public boolean apply(java.lang.Character character)
Description copied from interface:Predicate
Returns the result of applying this predicate toinput
(Java 8 users, see notes in the class documentation above). This method is generally expected, but not absolutely required, to have the following properties:- Its execution does not cause any observable side effects.
- The computation is consistent with equals; that is,
Objects.equal
(a, b)
implies thatpredicate.apply(a) == predicate.apply(b))
.
- Specified by:
apply
in interfacePredicate<java.lang.Character>
- Overrides:
apply
in classCharMatcher
-
toString
public java.lang.String toString()
Description copied from class:CharMatcher
Returns a string representation of thisCharMatcher
, such asCharMatcher.or(WHITESPACE, JAVA_DIGIT)
.- Overrides:
toString
in classCharMatcher
-
-