Beispiel #1
0
 /// <summary>
 /// Returns an unmodifiable <seealso cref="CharArraySet"/>. This allows to provide
 /// unmodifiable views of internal sets for "read-only" use.
 /// </summary>
 /// <param name="set">
 ///          a set for which the unmodifiable set is returned. </param>
 /// <returns> an new unmodifiable <seealso cref="CharArraySet"/>. </returns>
 /// <exception cref="NullPointerException">
 ///           if the given set is <code>null</code>. </exception>
 public static CharArraySet UnmodifiableSet(CharArraySet set)
 {
     if (set == null)
     {
         throw new System.NullReferenceException("Given set is null");
     }
     if (set == EMPTY_SET)
     {
         return(EMPTY_SET);
     }
     if (set.map is CharArrayMap.UnmodifiableCharArrayMap)
     {
         return(set);
     }
     return(new CharArraySet(CharArrayMap.unmodifiableMap(set.map)));
 }