VOOZH about

URL: https://www.geeksforgeeks.org/java/concurrentskiplistset-last-method-in-java/

⇱ ConcurrentSkipListSet last() method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

ConcurrentSkipListSet last() method in Java

Last Updated : 21 Sep, 2018
The last() method of java.util.concurrent.ConcurrentSkipListSet is an in-built function in Java which returns the last (highest) element currently in this set. Syntax:
public E last()
Return Value: The function returns returns the last (highest) element currently in this set. Exception: The function throws the NoSuchElementException if this set is empty. Below programs illustrate the ConcurrentSkipListSet.last() method: Program 1:
Output:
The highest element of the set: 78
Program 2: Program to show NoSuchElementException in last().
Comment