code: public void setCollator(RuleBasedCollator collator) {
          if (collator == null) {
              throw new IllegalArgumentException("Collator can not be null");
          }
          collator_ = collator;
          ceMask_ = getMask(collator_.getStrength());
  
          ULocale collLocale = collator.getLocale(ULocale.VALID_LOCALE);
          search_.internalBreakIter_ = BreakIterator.getCharacterInstance(collLocale == null ? ULocale.ROOT : collLocale);
          search_.internalBreakIter_.setText((CharacterIterator)search_.text().clone());  // We need to create a clone
  
          toShift_ = collator.isAlternateHandlingShifted();
          variableTop_ = collator.getVariableTop();
          textIter_ = new CollationElementIterator(pattern_.text_, collator);
          utilIter_ = new CollationElementIterator(pattern_.text_, collator);
  
          // initialize() _after_ setting the iterators for the new collator.
          initialize();
      }
docs: Sets the {@link RuleBasedCollator} to be used for language-specific searching.
  <p>
  The iterator's position will not be changed by this method.
  @param collator to use for this <tt>StringSearch</tt>
  @throws IllegalArgumentException thrown when collator is null
  @see #getCollator