# Class: com.pnfsoftware.jeb.util.collect.DisjointSets

This type represents disjoint sets. 

 The following operations define what a disjoint set is: 
 
- The [add1](#add(Object)) operation creates a new set with that value, unless an existing set containing that value already exists. 
- The [add2](#add(Object, Object)) operation adds two "connected elements": they must reside in the same set. If those two elements currently reside in two separate sets, those sets are merged. 

 

 This class does not override `hashCode/equals`. Internally, [HashSet](HashSet) objects are used. Therefore, there is no guarantee provided on elements ordering. 

 Objects of this class are serializable at the condition that T is serializable.

## Constructor: DisjointSets

Description: Create a new "disjoint sets" object

## Method: add
- parameter: `v`, type: `T`
- return type: `boolean`

Description: Create a set and add the provided value, unless a set with the value already exists.
parameter: v: a value
return: true if a new set was created to accommodate the provided value; false if the         provided value was already present in an existing set

## Method: add
- parameter: `a`, type: `T`
- parameter: `b`, type: `T`
- return type: `boolean`

Description: Add two linked values to the same set, potentially merging two existing sets into one.
parameter: a: first value
parameter: b: second value
return: true if the sets were modified; false if nothing changed

## Method: clear

Description: Clear all sets.

## Method: getCountOfValues
- return type: `int`

Description: Retrieve the count of elements existing in all the sets managed by this object.
return: total number of elements

## Method: getSets
- return type: `java.util.Collection<java.util.Set<T>>`

Description: Retrieve a read\-only view of the current disjoint sets managed by this object.
return: read\-only collection of read\-only sets

## Method: getValues
- return type: `java.util.Set<T>`

Description: Retrieve the values stored in all the sets managed by this object.
return: all stored values

## Method: isEmpty
- return type: `boolean`

Description: Determine whether this object contains at least one set.
return: true if no set is stored

## Method: size
- return type: `int`

Description: Retrieve the count of sets.
return: number of disjoint sets

## Method: toString
- return type: `java.lang.String`


