it.unimi.dsi.util
Class InternedMutableStringSet
java.lang.Object
it.unimi.dsi.fastutil.objects.AbstractObjectCollection<K>
it.unimi.dsi.fastutil.objects.AbstractObjectSet<K>
it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<MutableString>
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 classes/interfaces inherited from interface it.unimi.dsi.fastutil.Hash |
Hash.Strategy<K> |
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 java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
addAll, containsAll, removeAll, retainAll, toArray, toArray |
InternedMutableStringSet
public InternedMutableStringSet()
InternedMutableStringSet
public InternedMutableStringSet(int n,
float f)
InternedMutableStringSet
public InternedMutableStringSet(int n)
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.