Q:

How do find identical pairs in Collection?

If I have Collection of Set. And I must find identical pairs in Collection, 
i.e.:
Collection:

Set {Object_A, Object_B, Object_C} 
Set {Object_A, Object_B, Object_F}

How do find pair: Object_A-Object_B in Collection> ?
What Java library can be used for this purpose?

A:

If you want to use a lib, you could use Google Guava, and simply invoke:
Sets.intersection(setOne, setTwo);

See Sets.intersection().
For instance:
Sets.SetView<String> intersectionView = Sets.intersection(
    ImmutableSet.of("Object_A", "Object_B", "Object_C"),
    ImmutableSet.of("Object_A", "Object_B", "Object_D"));
Set<String> intersectionSet = intersectionView.immutableCopy();

intersectionView will be a view only "Object_A" and "Object_B" as elements, backed by both original sets. intersectionSet will be an immutable set of the intersection.
Refer to the Guava docs for more details and alternatives based on your needs (mutability, etc...).

