it.unimi.dsi.util
Class InternedMutableStringSet

java.lang.Object
  extended by it.unimi.dsi.fastutil.objects.AbstractObjectCollection<K>
      extended by it.unimi.dsi.fastutil.objects.AbstractObjectSet<K>
          extended by it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<MutableString>
              extended by it.unimi.dsi.util.InternedMutableStringSet
All Implemented Interfaces:
Hash, ObjectCollection<MutableString>, ObjectIterable<MutableString>, ObjectSet<MutableString>, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<MutableString>, java.util.Collection<MutableString>, java.util.Set<MutableString>

public class InternedMutableStringSet
extends ObjectOpenHashSet<MutableString>

A set of interned mutable strings.

This class extends ObjectOpenHashSet by providing an intern(MutableString) method with a semantics similar to that of String.intern().

See Also:
Serialized Form

Nested Class Summary
static class InternedMutableStringSet.Term
           
 
Nested classes/interfaces inherited from interface it.unimi.dsi.fastutil.Hash
Hash.Strategy<K>
 
Field Summary
 
Fields inherited from class it.unimi.dsi.fastutil.objects.ObjectOpenHashSet
count, f, free, growthFactor, key, maxFill, p, state
 
Fields inherited from interface it.unimi.dsi.fastutil.Hash
DEFAULT_GROWTH_FACTOR, DEFAULT_INITIAL_SIZE, DEFAULT_LOAD_FACTOR, FAST_LOAD_FACTOR, FREE, OCCUPIED, PRIMES, REMOVED, VERY_FAST_LOAD_FACTOR
 
Constructor Summary
InternedMutableStringSet()
           
InternedMutableStringSet(int n)
           
InternedMutableStringSet(int n, float f)
           
 
Method Summary
 InternedMutableStringSet.Term intern(MutableString s)
          Returns an interned, canonical copy contained in this set of the specified mutable string.
 
Methods inherited from class it.unimi.dsi.fastutil.objects.ObjectOpenHashSet
add, clear, clone, contains, findInsertionPoint, findKey, growthFactor, growthFactor, hashCode, isEmpty, iterator, rehash, rehash, remove, size, trim, trim
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectSet
equals
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectCollection
addAll, containsAll, objectIterator, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.unimi.dsi.fastutil.objects.ObjectCollection
objectIterator, toArray
 
Methods inherited from interface java.util.Set
addAll, containsAll, removeAll, retainAll, toArray, toArray
 

Constructor Detail

InternedMutableStringSet

public InternedMutableStringSet()

InternedMutableStringSet

public InternedMutableStringSet(int n,
                                float f)

InternedMutableStringSet

public InternedMutableStringSet(int n)
Method Detail

intern

public InternedMutableStringSet.Term intern(MutableString s)
Returns an interned, canonical copy contained in this set of the specified mutable string.

The semantics of this method is essentially the same as that of Collection.add(Object), but this method will return a mutable string equal to s currently in this set. The string will never be s, as in the case s is not in this set a compact copy of s will be stored instead.

The purpose of this method is similar to that of String.intern(), but obviously here the user has much greater control.

Parameters:
s - the mutable string that must be interned.
Returns:
the mutable string equal to s stored in this set.