测试源码:

 1     @org.junit.Test
2 public void testSetType(){
3 //测试set类型转string[]
4 //
5 Set<String> s =new HashSet<>();
6 s.add("55555");
7 s.add("sghj");
8 s.add("7867sgh");
9 //
10 String[] strs = s.toArray(new String[s.size()]);
11 //
12 for (String kk :strs){
13 System.out.println(kk);
14 }
15 //判断类型
16 System.out.println(strs instanceof String[]);
17
18 }

测试截图:

set类型转string[] 正确写法的更多相关文章

  1. ibatis使用iterate实现批量插入insert正确写法

    由于想批量入库提升效率,最近实现了ibatis的批量插入,结果一直报错 :StringIndexOutOfBoundsException ,原来是value中的格式不正确. 本人邮箱:techqu@1 ...

  2. 【记录】AutoMapper Project To OrderBy Skip Take 正确写法

    AutoMapper:Queryable Extensions 示例代码: using (var context = new orderEntities()) { return context.Ord ...

  3. Python 3之str类型、string模块学习笔记

    Windows 10家庭中文版,Python 3.6.4, Python 3.7官文: Text Sequence Type — str string — Common string operatio ...

  4. ***PHP $_FILES函数详解 + PHP文件上传 move_uploaded_file() 参数的正确写法

    PHP $_FILES函数详解 在PHP中上传一个文件建一个表单要比ASP中灵活得多.具体的看代码. 如:  复制代码代码如下: <form enctype="multipart/fo ...

  5. obj.style.z-index的正确写法

    obj.style.z-index的正确写法 今天发现obj.style.z-index在js里面报错,后来才知道在js里应该把含"-"的字符写成驼峰式,例如obj.style.z ...

  6. C++中虚继承派生类构造函数的正确写法

    最近工作中某个软件功能出现了退化,追查下来发现是一个类的成员变量没有被正确的初始化.这个问题与C++存在虚继承的情况下派生类构造函数的写法有关.在此说明一下错误发生的原因,希望对更多的人有帮助. 我们 ...

  7. C++ double类型转string类型后,怎么实现小数点后只显示一个数字

    C++ double类型转string类型后,怎么实现小数点后只显示一个数字 #include <iostream> #include <sstream> #include & ...

  8. Web Service接口返回泛型的问题(System.InvalidCastException: 无法将类型为“System.Collections.Generic.List`1[System.String]”的对象强制转换为类型“System.String[]”)

    在使用C#写Web Service时遇到了个很奇怪的问题.返回值的类型是泛型(我用的是类似List<string>)的接口,测试时发现总是报什么无法转换为对象的错误,百思不得其解. 后来在 ...

  9. 使用runloop阻塞线程的正确写法

    使用runloop阻塞线程的正确写法 runloop可以阻塞线程,等待其他线程执行后再执行. 比如: @implementation ViewController{    BOOL end;}…– ( ...

随机推荐

  1. intelliJ破解及JavaEE搭建

    intellij2020.3破解 转载自https://www.exception.site/essay/how-to-free-use-intellij-idea-2019-3 第一步: 下载最新的 ...

  2. [BUUCTF]PWN——[V&N2020 公开赛]warmup

    [V&N2020 公开赛]warmup 附件 步骤: 例行检查,64位程序,除了canary,其他保护都开 本地运行一下,看看大概的情况 64位ida载入,从main函数开始看程序 看到程序将 ...

  3. [BUUCTF]PWN14——not_the_same_3dsctf_2016

    [BUUCTF]PWN14--not_the_same_3dsctf_2016 题目网址:https://buuoj.cn/challenges#not_the_same_3dsctf_2016 步骤 ...

  4. mysql联合查询更新数据库例子

    mysql联合查询更新数据库例子,用户表,部门表,把用户表中的部门属性更新为部门表的主键UPDATE user_table AS utINNER JOIN belongdept AS bd ON bd ...

  5. jackson-databind-2.2.3.jar,ackson-annotations-2.2.3.jar和jackson-core-2.2.3.jar下载

    jackson包开发下载,包括如下3个jar文件 jackson-databind-2.2.3.jar,还需要jackson-annotations-2.2.3.jar和jackson-core-2. ...

  6. C语言获取文件大小(字节)

    代码 核心代码 FILE *pfile = nullptr; int ret = fopen_s(&pfile, str.c_str(), "rb"); /// 0 = 打 ...

  7. C. Watching Fireworks is Fun(Codeforces 372C)

    C. Watching Fireworks is Fun time limit per test 4 seconds memory limit per test 256 megabytes input ...

  8. Polyomino Composer(UVA12291)

    Description   Polyomino Composer  A polyomino is a plane geometric figure formed by joining one or m ...

  9. 1025 - The Specials Menu

    1025 - The Specials Menu    PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 ...

  10. 「ARC096C」Everything on It

    Solution 容斥,钦定 \(i\) 个数 \(\leq 1\) 次. \[Ans=\sum_{i=0}^n (-1)^i\binom{n}{i}F(i) \] 其中 \(F(i)\) 表示有 \ ...