Package com.maybeitssquid.safeascii
Class SingleCharacterFilter
java.lang.Object
com.maybeitssquid.safeascii.SingleCharacterFilter
- All Implemented Interfaces:
IntFunction<CharSequence>
Filters out results that are not single characters.
-
Constructor Summary
ConstructorsConstructorDescriptionSingleCharacterFilter(IntFunction<CharSequence> delegate) Creates a new SingleCharacterFilter with the specified delegate. -
Method Summary
Modifier and TypeMethodDescriptionapply(int value) Applies the delegate function and returns the result only if it is a single character.
-
Constructor Details
-
SingleCharacterFilter
Creates a new SingleCharacterFilter with the specified delegate.- Parameters:
delegate- the function to apply before filtering
-
-
Method Details
-
apply
Applies the delegate function and returns the result only if it is a single character.- Specified by:
applyin interfaceIntFunction<CharSequence>- Parameters:
value- the Unicode codepoint to process- Returns:
- the delegate's result if it is exactly one character, otherwise an empty string
-