【剑指offer知识点】List转int[],List转String,String转int,char[]转String,String 转char[],List转String[]

简介: 【剑指offer知识点】List转int[],List转String,String转int,char[]转String,String 转char[],List转String[]

[1] List转int[]


List<Integer> list=new ArrayList<Integer>();
list.stream().mapToInt(Integer::intValue).toArray(); // 方法一
list.stream().mapToInt(i->i).toArray(); // 方法二

[2] List转String


List<String> l = new ArrayList<>();
l.stream().map(String::valueOf).collect(Collectors.joining(",")); // 方法一
String test = String.join(",",l); // 方法二

[3] String转int


Integer.parseInt(“100”);

[4] char[]转String


String s;
Char[] arr = s.toCharArray()

[5] String 转char[]


String s = String.valueOf(arr)

[6] List转String[]

list.toArray(new String[list.size()])
相关文章
|
JSON 前端开发 Java
List<String> 如何传参
List<String> 如何传参
1953 0
|
存储 JSON NoSQL
redis基本数据结构(String,Hash,Set,List,SortedSet)【学习笔记】
这篇文章是关于Redis基本数据结构的学习笔记,包括了String、Hash、Set、List和SortedSet的介绍和常用命令。文章解释了每种数据结构的特点和使用场景,并通过命令示例演示了如何在Redis中操作这些数据结构。此外,还提供了一些练习示例,帮助读者更好地理解和应用这些数据结构。
redis基本数据结构(String,Hash,Set,List,SortedSet)【学习笔记】
|
存储 C语言
使用 sizeof 操作符计算int, float, double 和 char四种变量字节大小
【10月更文挑战第13天】使用 sizeof 操作符计算int, float, double 和 char四种变量字节大小。
865 1
|
存储 分布式计算 NoSQL
大数据-40 Redis 类型集合 string list set sorted hash 指令列表 执行结果 附截图
大数据-40 Redis 类型集合 string list set sorted hash 指令列表 执行结果 附截图
273 3
|
存储 C语言
计算 int, float, double 和 char 字节大小
计算 int, float, double 和 char 字节大小。
596 3
|
NoSQL Java Redis
redis-学习笔记(string , hash , list , set , zset 前置知识)
redis-学习笔记(string , hash , list , set , zset 前置知识)
297 0
redis-学习笔记(string , hash , list , set , zset 前置知识)
new String()定义字符串为空,char[] chs = {‘a‘,‘b‘,‘c‘} String s2 = new String(chs) 输出abc,byte定99为a
new String()定义字符串为空,char[] chs = {‘a‘,‘b‘,‘c‘} String s2 = new String(chs) 输出abc,byte定99为a
|
Java API
将`List<String>`转换为`List<Long>`
将`List<String>`转换为`List<Long>`
1591 0
|
小程序 Android开发
写个知识点吧,关于va_list的,也是关于2dx的
写个知识点吧,关于va_list的,也是关于2dx的
|
存储 Web App开发 编译器
C语言程序设计——int,double,char的用法
C语言程序设计——int,double,char的用法