Java SortedSet getSortedTypes(Class[] types)

Here you can find the source of getSortedTypes(Class[] types)

Description

get Sorted Types

License

Apache License

Declaration

private static SortedSet<Class<?>> getSortedTypes(Class<?>[] types) 

Method Source Code

//package com.java2s;
/*/* w w  w .j a  v a  2 s  . com*/
 * Copyright Terracotta, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.util.Comparator;

import java.util.SortedSet;
import java.util.TreeSet;
import static java.util.Arrays.asList;

public class Main {
    private static final Comparator<Class<?>> CLASS_COMPARATOR = new Comparator<Class<?>>() {
        public int compare(final Class<?> o1, final Class<?> o2) {
            return o1.getName().compareTo(o2.getName());
        }
    };

    private static SortedSet<Class<?>> getSortedTypes(Class<?>[] types) {
        final TreeSet<Class<?>> classes = new TreeSet<Class<?>>(CLASS_COMPARATOR);
        if (types != null) {
            classes.addAll(asList(types));
        }
        return classes;
    }
}

Related

  1. entriesSortedByValues( Map map)
  2. fillOutHourly(SortedSet hours)
  3. getEntryOrEmptySet(K key, Map> map)
  4. getFlatItems(Map> linkedWorkItemIDsMap)
  5. getSortedIntersectionValues(Collection colection1, Collection colection2)
  6. intersect(SortedSet pSet1, SortedSet pSet2)
  7. intersectSorted(final Collection c1, final Collection c2)
  8. mapToSortedSet(Map map)
  9. newSortedSet()