Package com.isode.dsapi.util
Class DNSet
java.lang.Object
com.isode.dsapi.util.DNSet
A class which contains a set of DNs stored in memory in a very
compact form (backed by a DS_DNIndex). This might be slower than a
normal Set (due to conversions and JNI), but the point is more
the compactness of the storage, allowing very large lists of DNs to
be represented in memory.
Note that DN comparison is done without using the syntax-specific comparison routines -- instead only case-exact or case-insensitive matches are done, according to the attribute. This means that alternative textual representations of the same value (e.g. with/without insignificant spaces) will appear as different DNs in the set. It is important that DNSet is not used in situations where this would be a problem.
- Since:
- 14.6
- Author:
- jp
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd a DN to the set.booleanaddAll(Collection<? extends DN> c) Add all the provided DNs to the set.voidclear()Clear the set.booleanTest whether the set contains the given DN.booleancontainsAll(Collection<?> c) Check whether the set contains all the provided DNs.booleanWe don't support comparison of sets, so only return true if this is the exact same DNSet.protected voidfinalize()Release any native structures associated with this object.inthashCode()Generate a hash.booleanisEmpty()Test whether the set is empty.iterator()Iterate through the DNs in the set.booleanRemove a DN from the set.booleanremoveAll(Collection<?> c) Remove all DNs that match DNs in the given collection.booleanretainAll(Collection<?> c) Unsupported.intsize()Return the size of the set.Object[]toArray()Convert into an array.<T> T[]toArray(T[] arr) Convert into an array.toString()Returns a String representation of the objectMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
spliterator
-
Constructor Details
-
DNSet
Create a DNSet.- Throws:
NativeLibraryException
-
-
Method Details
-
size
public int size()Return the size of the set. This has to iterate through the whole set to count the items. -
isEmpty
public boolean isEmpty()Test whether the set is empty. -
contains
Test whether the set contains the given DN. -
iterator
Iterate through the DNs in the set. Note that this has some restrictions: that modifictions are not permitted during the iteration (not even removal), and it is not possible to have more than one simultaneous iterator. -
toArray
Convert into an array. -
toArray
public <T> T[] toArray(T[] arr) Convert into an array. Always throws away the argument array, so better to just use toArray(). -
add
Add a DN to the set. -
remove
Remove a DN from the set. -
containsAll
Check whether the set contains all the provided DNs.- Specified by:
containsAllin interfaceCollection<DN>- Specified by:
containsAllin interfaceSet<DN>
-
addAll
Add all the provided DNs to the set. -
retainAll
Unsupported. -
removeAll
Remove all DNs that match DNs in the given collection. -
clear
public void clear()Clear the set. -
equals
We don't support comparison of sets, so only return true if this is the exact same DNSet. -
hashCode
public int hashCode()Generate a hash. -
finalize
Release any native structures associated with this object. -
toString
Returns a String representation of the object
-