public static CharArraySet copy(final Set<?> set) {
    if(set == EMPTY_SET)
      return EMPTY_SET;
    if(set instanceof CharArraySet source) {
        return new CharArraySet(CharArrayMap.copy(source.map));
    }
    return new CharArraySet(set, false);
  }
Returns a copy of the given set as a {@link CharArraySet}. If the given set
is a {@link CharArraySet} the ignoreCase property will be preserved.

@param set
         a set to copy
@return a copy of the given set as a {@link CharArraySet}. If the given set
        is a {@link CharArraySet} the ignoreCase property as well as the
        matchVersion will be of the given set will be preserved.
linguistics/src/main/java/com/yahoo/language/simple/kstem/CharArraySet.java