Java Set Intersect intersectComparable(Set left, Set right)

Here you can find the source of intersectComparable(Set left, Set right)

Description

intersect Comparable

License

Open Source License

Declaration

public static <T extends Comparable<T>> Set<T> intersectComparable(Set<T> left, Set<T> right) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static <T extends Comparable<T>> Set<T> intersectComparable(Set<T> left, Set<T> right) {
        List<T> mid = new LinkedList<T>(left);
        mid.removeAll(right);/*w w w . j  a  va2  s .c  om*/
        Set<T> result = new TreeSet<T>(left);
        result.removeAll(mid);
        return result;
    }
}

Related

  1. intersect(final Set firstSet, final Set secondSet)
  2. intersect(Set one, Set two)
  3. intersect(Set set1, Set set2)
  4. intersect(Set a, Set b)
  5. intersect(Set a, Set b)
  6. intersection(final Set set1, final Set set2)
  7. intersection(Set a, Set b)
  8. intersection(Set sa, Set sb)
  9. intersection(Set first, Set second)