Java TreeSet toTreeSet(Collection collection, Comparator comparator)

Here you can find the source of toTreeSet(Collection collection, Comparator comparator)

Description

to Tree Set

License

Apache License

Declaration

public static <T> TreeSet<T> toTreeSet(Collection<T> collection, Comparator<T> comparator) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Collection;

import java.util.Comparator;

import java.util.TreeSet;

public class Main {

    public static <T> TreeSet<T> toTreeSet(Collection<T> collection, Comparator<T> comparator) {
        final TreeSet<T> treeSet = new TreeSet<T>(comparator);
        for (T t : collection) {
            treeSet.add(t);//  w  w  w. jav  a  2  s .co  m
        }
        return treeSet;
    }
}

Related

  1. getVariance(TreeSet positions)
  2. intersection(TreeSet AL1, TreeSet AL2)
  3. minDiff(TreeSet numbers)
  4. newTreeSet(final Collection c)
  5. toTreeSet(Collection lines)
  6. treeSet(E... add)
  7. treeSet(final Collection collection)
  8. treeSet(final T item)