CollectionUtils.java 文件源码

java
阅读 49 收藏 0 点赞 0 评论 0

项目:andbg 作者:
@Nonnull
private static <T> SortedSet<? extends T> toSortedSet(@Nonnull Comparator<? super T> elementComparator,
                                                      @Nonnull Collection<? extends T> collection) {
    if (collection instanceof SortedSet) {
        SortedSet<? extends T> sortedSet = (SortedSet<? extends T>)collection;
        Comparator<?> comparator = sortedSet.comparator();
        if (comparator != null && comparator.equals(elementComparator)) {
            return sortedSet;
        }
    }
    return ImmutableSortedSet.copyOf(elementComparator, collection);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号