Kotlin Language Documentation 1.3
vice versa. val sourceList = mutableListOf(1, 2, 3) val copySet = sourceList.toMutableSet() copySet.add(3) copySet.add(4) println(copySet) Alternatively, you can create new references to the same0 码力 | 597 页 | 3.61 MB | 1 年前3Kotlin Language Documentation 1.9.20
void listToSet() { var sourceList = List.of(1, 2, 3, 1); var copySet = Set.copyOf(sourceList); System.out.println(copySet); } In Kotlin, use the function toSet(): fun main() { //sampleStart //sampleStart // Kotlin val sourceList = listOf(1, 2, 3, 1) val copySet = sourceList.toSet() 625 println(copySet) //sampleEnd } Group elements In Java, you can group elements with the Collectors val sourceList = mutableListOf(1, 2, 3) val copySet = sourceList.toMutableSet() copySet.add(3) copySet.add(4) println(copySet) //sampleEnd } Alternatively, you can create new references0 码力 | 1299 页 | 32.44 MB | 1 年前3Kotlin 1.9.10 官方文档 中文版
void listToSet() { var sourceList = List.of(1, 2, 3, 1); var copySet = Set.copyOf(sourceList); System.out.println(copySet); } In Kotlin, use the function toSet() : fun main() { //sampleStart //sampleStart // Kotlin val sourceList = listOf(1, 2, 3, 1) val copySet = sourceList.toSet() println(copySet) //sampleEnd } 元素分组 In Java, you can group elements with the Collectors function val sourceList = mutableListOf(1, 2, 3) val copySet = sourceList.toMutableSet() copySet.add(3) copySet.add(4) println(copySet) //sampleEnd } 或者,可以创建对同一集合实例的新引用。使用现有集合初始化集合变量时,0 码力 | 3753 页 | 29.69 MB | 1 年前3Kotlin 官方文档中文版 v1.9
void listToSet() { var sourceList = List.of(1, 2, 3, 1); var copySet = Set.copyOf(sourceList); System.out.println(copySet); } In Kotlin, use the function toSet() : fun main() { //sampleStart //sampleStart // Kotlin val sourceList = listOf(1, 2, 3, 1) val copySet = sourceList.toSet() println(copySet) //sampleEnd } 元素分组 In Java, you can group elements with the Collectors function val sourceList = mutableListOf(1, 2, 3) val copySet = sourceList.toMutableSet() copySet.add(3) copySet.add(4) println(copySet) //sampleEnd } 或者,可以创建对同一集合实例的新引用。使用现有集合初始化集合变量时,将创建新引0 码力 | 2049 页 | 45.06 MB | 1 年前3
共 4 条
- 1