Java ConcurrentSkipListSet first()方法
java.util.concurrent.ConcurrentSkipListSet的first()方法是Java中的一个内置函数,用于返回当前该集合中的第一个(最低)元素。
语法
返回值: 该函数返回当前这个集合中的第一个(最低)元素。
异常: 如果这个集合是空的,该函数会抛出NoSuchElementException。
下面的程序说明了ConcurrentSkipListSet.first()方法。
程序1 :
输出。
**
****程序2:** 在first()中显示NoSuchElementException的程序。
输出。
参考资料: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentSkipListSet.html#first-