Beispiel #1
0
 /// <summary>
 /// Returns a copy of the given set as a <seealso cref="CharArraySet"/>. If the given set
 /// is a <seealso cref="CharArraySet"/> the ignoreCase property will be preserved.
 /// <para>
 /// <b>Note:</b> If you intend to create a copy of another <seealso cref="CharArraySet"/> where
 /// the <seealso cref="LuceneVersion"/> of the source set differs from its copy
 /// <seealso cref="#CharArraySet(Version, Collection, boolean)"/> should be used instead.
 /// The <seealso cref="#copy(Version, Set)"/> will preserve the <seealso cref="LuceneVersion"/> of the
 /// source set it is an instance of <seealso cref="CharArraySet"/>.
 /// </para>
 /// </summary>
 /// <param name="matchVersion">
 ///          compatibility match version see <a href="#version">Version
 ///          note</a> above for details. This argument will be ignored if the
 ///          given set is a <seealso cref="CharArraySet"/>. </param>
 /// <param name="set">
 ///          a set to copy </param>
 /// <returns> a copy of the given set as a <seealso cref="CharArraySet"/>. If the given set
 ///         is a <seealso cref="CharArraySet"/> the ignoreCase property as well as the
 ///         matchVersion will be of the given set will be preserved. </returns>
 public static CharArraySet Copy <T1>(LuceneVersion matchVersion, HashSet <T1> set)
 {
     if (set == EMPTY_SET)
     {
         return(EMPTY_SET);
     }
     if (set is CharArraySet)
     {
         CharArraySet source = (CharArraySet)set;
         return(new CharArraySet(CharArrayMap.copy(source.map.matchVersion, source.map)));
     }
     return(new CharArraySet(matchVersion, set, false));
 }