当前位置: 代码迷 >> 综合 >> val digits = Set(1,7,8,0) val a= digits contains 0 System.out.println(a) val b = S
  详细解决方案

val digits = Set(1,7,8,0) val a= digits contains 0 System.out.println(a) val b = S

热度:4   发布时间:2024-01-16 08:51:26.0
集合的操作 /用于添加或去除元素的操作符  
val digits = Set(1,7,8,0)val a= digits contains 0
  System.out.println(a)val b = Set(1,7).subsetOf(digits)System.out.println(b)val primes = Set(2,3,5,7)val u = digits union primes  u.foreach(System.out.println(_))
val u1 = digits & primes u1.foreach(System.out.println(_))
val u2 = digits -- primes u2.foreach(System.out.println(_))
 
 
 
 
 
 

  相关解决方案