SortedSet.last() has the following syntax.
E last()
In the following code shows how to use SortedSet.last() method.
/* w w w . j av a 2 s .c o m*/ import java.util.SortedSet; import java.util.TreeSet; public class Main { public static void main(String[] argv) throws Exception { SortedSet<String> set = new TreeSet<String>(); set.add("b"); set.add("c"); set.add("a"); System.out.println(set.last()); } }
The code above generates the following result.