java 方法 示例

集合类SynchronizedSortedSet()方法 (Collections Class synchronizedSortedSet() method)

  • synchronizedSortedSet() method is available in java.util package.

    java.util软件包中提供了sharedSortedSet ()方法

  • synchronizedSortedSet() method is used to return the synchronized view of the given sorted set (ss).

    sharedSortedSet()方法用于返回给定排序集(ss)的同步视图。

  • synchronizedSortedSet() method is a static method, it is accessible with the class name and if we try to access the method with the class object then also we will not get any error.

    synchronizedSortedSet()方法是一个静态方法,可以使用类名进行访问,如果尝试使用类对象访问该方法,那么也不会出现任何错误。

  • synchronizedSortedSet() method does not throw an exception at the time of returning the synchronized sorted set.

    返回同步的排序集时,syncedSortedSet ()方法不会引发异常。

Syntax:

句法:

    public static SortedSet synchronizedSortedSet(SortedSet ss);

Parameter(s):

参数:

  • SortedSet ss – represents the sorted set to be viewed in synchronized sorted set.

    ssortedSet ss –表示要在同步排序集中查看的排序集。

Return value:

返回值:

The return type of this method is SortedSet, it returns synchronized view of the given sorted set.

此方法的返回类型为SortedSet ,它返回给定排序集的同步视图。

Example:

例:

// Java program to demonstrate the example
// of SortedSet synchronizedSortedSet() method
// of Collections
import java.util.*;
public class SynchronizedSortedSetOfCollections {public static void main(String args[]) {// Instantiates a sorted set object
SortedSet < Integer > ss = new TreeSet < Integer > ();
// By using add() method is to add
// objects in a sorted set
ss.add(20);
ss.add(10);
ss.add(40);
ss.add(30);
ss.add(50);
// Display Sorted Set
System.out.println("SortedSet: " + ss);
// By using SynchronizedSortedSet() method is to
// represent the tree set in synchronized view
ss = Collections.synchronizedSortedSet(ss);
// Display Synchronized Sorted Set
System.out.println("Collections.synchronizedSortedSet(ss): " + ss);
}
}

Output

输出量

SortedSet: [10, 20, 30, 40, 50]
Collections.synchronizedSortedSet(ss): [10, 20, 30, 40, 50]

翻译自: https://www.includehelp.com/java/collections-synchronizedsortedset-method-with-example.aspx

java 方法 示例

java 方法 示例_Java集合syncedSortedSet()方法与示例相关推荐

  1. List精讲(Java版)·算法常用集合处理方法

    List精讲(Java版)·算法常用集合处理方法 请仔细查阅每一个注释: import java.util.ArrayList; import java.util.Collections; impor ...

  2. java 方法 示例_Java集合syncedSet()方法与示例

    java 方法 示例 集合类syncedSet()方法 (Collections Class synchronizedSet() method) synchronizedSet() method is ...

  3. java set 包含_Java Set.contains()方法:判断Set集合是否包含指定的对象

    Java 集合类中的 Set.contains() 方法判断 Set 集合是否包含指定的对象.该方法返回值为 boolean 类型,如果 Set 集合包含指定的对象,则返回 true,否则返回 fal ...

  4. java secretkey用法_Java SecretKeyFactory.generateSecret方法代码示例

    本文整理汇总了Java中javax.crypto.SecretKeyFactory.generateSecret方法的典型用法代码示例.如果您正苦于以下问题:Java SecretKeyFactory ...

  5. java集合的遍历_java集合遍历方法总结

    java集合遍历方法总结 一.for循环遍历集合 使用条件: ①能否确定集合中的元素个数 ②集合是否可以通过整数索引值来精确位置 public static void forTraversal(){ ...

  6. java中断响应时间_Java多线程 sleep方法响应中断 sleep面试问题(与wait/notify的

    Java多线程 sleep方法响应中断 sleep面试问题(与wait/notify的 Java多线程 sleep方法响应中断 & sleep面试问题(与wait/notify的比较) 文章目 ...

  7. java wait 参数_Java Object wait()方法

    Java Object wait()方法 java.lang.Object.wait(long timeout, int nanos) 导致当前线程等待,直到其他线程调用此对象的 notify() 方 ...

  8. java printwriter追加_Java PrintWriter append()方法

    Java PrintWriter append()方法 java.io.PrintWriter.append(char c) 方法将指定字符到此Writer. 1 语法 public PrintWri ...

  9. java 发送邮件 菜鸟_Java发送邮件的方法

    1.需要的jar包 2.具体实现方法 1.设置邮箱主机.需要认证.邮箱协议 Properties pro=new Properties(); pro.setProperty("mail.ho ...

最新文章

  1. linux中LVM动态扩容和管理
  2. 面试程序员总结的通病!
  3. 《软件观念革命——交互设计精髓》读书笔记(一)
  4. Android中Activity的启动流程和组织管理方式(Backstack、Task)
  5. Android应用程序框架
  6. 解决安装win7后ubuntu无法启动问题
  7. c 子类对象 访问父类对象受保护成员_C++日志(三十四)子类同名成员与作用域分辨符...
  8. 判断鼠标是否在元素上_能不能从大便上判断出一个人是否患有结肠癌?
  9. k8s核心技术-Controller(Deployment)_概述和应用场景---K8S_Google工作笔记0028
  10. /dev/null脚本中作用
  11. cad插件_CAD插件自动标注
  12. 首次适应算法的模拟C++实现(没有)
  13. webpy中如何返回json格式给前端
  14. 【转】Android兼容性测试的一些坑
  15. ACC-C++组初赛
  16. nyoj1273 河南省第九届省赛_宣传墙、状压DP+矩阵幂加速
  17. python代码计算字数_如何用python计算文件的字数
  18. 【第五周】新蜂团体贡献分
  19. 电脑显示器基本设置与故障处理
  20. 支持向量机——线性可分支持向量机

热门文章

  1. windows apache部署php,Windows下部署Apache+PHP+MySQL运行环境实战
  2. ios 获取是否静音模式_果粉感动:部分iOS“新功能”早已被安卓玩坏
  3. php-cli下载,php-cli-color
  4. php用正则去掉一些固定字符,用PHP正则表达式清除字符串的空白
  5. 关于nodejs中npm命令没有反应的解决方法
  6. vue之computed和watch
  7. 在Bootstrap框架中,form-control的效果
  8. CSS实现响应式布局(自动拆分几列)
  9. 动态规划--图像压缩
  10. 从xtrabackup备份恢复单表【转】