Q:

How to implement Python's issuperset() in Scala

Sorry for newbie question. I try to implement Pythons issuperset() with Scala class
Python example:
 weighted_fruits_set = {"banana", "orange","apple"}
 check = {"banana"}
 weighted_fruits_set.issuperset(check)

Python answers :"True"
my Scala code below, I tried contains to find superset from list of case class weightedFruits and I check if string "banana" exists in weightedFruits.name :
object Learn extends App {

  case class weightedFruits(name:List[String], weight:Double) {
override def toString = s"name: ${name.mkString("<", ",", ">")}, weight: $weight\n"
 }

 var weightedFruitsList = new scala.collection.mutable.ListBuffer[weightedFruits]()

 weightedFruitsList += ( 
                     weightedFruits(List("banana","orange"),180),
                     weightedFruits(List("banana","orange","apple"),170),                                 
                     weightedFruits(List("feijoa","fig"),201),
                     weightedFruits(List("banana","apple","melon"),165)
                     )

val check = weightedFruits(List("banana"),200)                       

weightedFruitsList += check                       

val item = weightedFruitsList(1)

val bol:Boolean = item.name.contains(check.name)

println("item: "+item)
println("check: "+check)
println("bool: "+bol)

}

The output of my code is false (but must be true) :
item: name: <banana,orange,apple>, weight: 170.0

check: name: <banana>, weight: 200.0

bool: false

Thanks for any help. I truly hope my explanation was clear 

A:

The other current answers are, in my opinion, doing more than they need to. If set A is a subset of set B, then all elements of A are in B. So if we remove all elements of B from A, there should be nothing left. So
val a = List("banana") 
val b = List("banana", "orange","apple")
val c = List("tomato") 

(a diff b).isEmpty                                //> true
(c diff b).isEmpty                                //> false

(You don't specify what should happen if either "set" contains duplicates)
And if you're actually using Sets and not Lists, this operation is already in the standard library
def subsetOf(that: GenSet[A]): Boolean

Tests whether this set is a subset of another set. that the set to
      test. returns true if this set is a subset of that, i.e. if every
      element of this set is also an element of that

See Scaladoc here
So you can convert your "sets" to actual Sets with .toSet, and use this

