Example usage for java.util Collections checkedSortedSet

List of usage examples for java.util Collections checkedSortedSet

Introduction

In this page you can find the example usage for java.util Collections checkedSortedSet.

Prototype

public static <E> SortedSet<E> checkedSortedSet(SortedSet<E> s, Class<E> type) 

Source Link

Document

Returns a dynamically typesafe view of the specified sorted set.

Usage

From source file:Main.java

public static void main(String args[]) {

    SortedSet<String> sset = new TreeSet<String>();

    sset.add("tutorial");
    sset.add("from");
    sset.add("java2s.com");

    // get typesafe view of the sorted set
    SortedSet<String> tsset = Collections.checkedSortedSet(sset, String.class);

    System.out.println(tsset);/*from w  w w  .j a v a 2  s  .c  o  m*/
}