If this set matches a single character, then return an optional with that character.
Otherwise return an empty optional.
960131
public Optional<Character> character() {
    char c = 0;
    int count = 0;
    for (int i = 0; i < members.length; ++i) {
      if (members[i]) {
        c = (char) i;
        ++count;
      }
    }
    return (count == 1) ? Optional.of(c) : Optional.empty();
  }
542337
public static CharMatcher isNot(final char match) {
    return new FastMatcher() {
      @Override public boolean matches(char c) {
        return c != match;
      }

      @Override public CharMatcher and(CharMatcher other) {
        return other.matches(match) ? super.and(other) : other;
      }

      @Override public CharMatcher or(CharMatcher other) {
        return other.matches(match) ? ANY : this;
      }

      @GwtIncompatible("java.util.BitSet")
      @Override
      void setBits(BitSet table) {
        table.set(0, match);
        table.set(match + 1, Character.MAX_VALUE + 1);
      }

      @Override public CharMatcher negate() {
        return is(match);
      }

      @Override public String toString() {
        return "CharMatcher.isNot('" + showCharacter(match) + "')";
      }
    };
  }
259229
def optional(e, default=Ignore):
    
    def match_optional(s, grm=None, pos=0):
        try:
            return e(s, grm, pos)
        except PegreError:
            return PegreResult(s, default, (pos, pos))
    return match_optional
43089
def optional(self):
        """"""
        value = self._schema.get("optional", False)
        if value is not False and value is not True:
            raise SchemaError(
                "optional value {0!r} is not a boolean".format(value))
        return value
1229365
def nsUriMatch(self, value, wanted, strict=0, tt=type(())):
        """"""
        if value == wanted or (type(wanted) is tt) and value in wanted:
            return 1
        if not strict and value is not None:
            wanted = type(wanted) is tt and wanted or (wanted,)
            value = value[-1:] != '/' and value or value[:-1]
            for item in wanted:
                if item == value or item[:-1] == value:
                    return 1
        return 0
74719
def match_string(self, string, word=0, offset=0):
        
        if word:
            return self.get_string(offset) == string
        return self.get_length(len(string), offset) == string
1009226
public static CharMatcher isNot(final char match) {
    return new FastMatcher() {
      @Override public boolean matches(char c) {
        return c != match;
      }

      @Override public CharMatcher and(CharMatcher other) {
        return other.matches(match) ? super.and(other) : other;
      }

      @Override public CharMatcher or(CharMatcher other) {
        return other.matches(match) ? ANY : this;
      }

      @Override public CharMatcher negate() {
        return is(match);
      }

      @Override public String toString() {
        return "CharMatcher.isNot('" + showCharacter(match) + "')";
      }
    };
  }
79373
def match(self, string):
        """"""
        if self.casesensitive:
            return self.pattern == os.path.normcase(string)
        else:
            return self.pattern.lower() == os.path.normcase(string).lower()
434708
def _check_default(value, parameter, default_chars):
    ''''''
    # not using a set here because it fails when value is unhashable
    if value in default_chars:
        if parameter.default is inspect.Parameter.empty:
            raise ValueError('Value was empty, but no default value is given in view function for parameter: {} ({})'.format(parameter.position, parameter.name))
        return parameter.default
    return value
1362660
def p_startswith(self, st, ignorecase=False):
        ""
        length = len(st)
        matcher = result = self.input[self.pos:self.pos + length]
        if ignorecase:
            matcher = result.lower()
            st = st.lower()
        if matcher == st:
            self.pos += length
            return result
        return False
613405
public static StrMatcher charSetMatcher(final String chars) {
        if (StringUtils.isEmpty(chars)) {
            return NONE_MATCHER;
        }
        if (chars.length() == 1) {
            return new CharMatcher(chars.charAt(0));
        }
        return new CharSetMatcher(chars.toCharArray());
    }
1055757
def _validate_optional_key(key, missing, value, validated, optional):
    """"""
    try:
        validated[key] = optional[key](value)
    except NotValid as ex:
        return ['%r: %s' % (key, arg) for arg in ex.args]
    if key in missing:
        missing.remove(key)
    return []
362807
private static String checkForEmptyString(String s) {
        if (s == null) return null;
        if (s.length() == 0) return null;

        return s;
    }
132313
def ismatch(text, pattern):
    """"""

    if hasattr(pattern, 'search'):
        return pattern.search(text) is not None
    else:
        return pattern in text if Config.options.case_sensitive \
            else pattern.lower() in text.lower()
805850
function(match, matchIndex, characterOffset) {

      if (!match[0]) {
        throw new Error('findAndReplaceDOMText cannot handle zero-length matches')
      }
   
      match.endIndex = characterOffset + match.index + match[0].length
      match.startIndex = characterOffset + match.index
      match.index = matchIndex
      return match
    }
201450
def star_sep_check(self, original, loc, tokens):
        """"""
        return self.check_py("3", "keyword-only argument separator (add 'match' to front to produce universal code)", original, loc, tokens)
83874
public static Optional<OffsetRange<CharOffset>> charOffsetsOfWholeString(String s) {
    if (s.isEmpty()) {
      return Optional.absent();
    }
    return Optional.of(charOffsetRange(0, s.length() - 1));
  }