Scala append or concat to list depending on type
<p>Let say I have a List[Int] a, b and Int c:</p>

<pre><code>val a: List[Int] = List(1, 2, 3)
val b: List[Int] = List(4, 5, 6)
val c: Int = 7

val d: List[Int] = a ++ b
val e: List[Int] = a :+ c
</code></pre>

<p>In both <code>d</code> and <code>e</code>, we get the same output. But we need different operators.</p>

<p>My question is: is there any operator or a function that takes in a list and a object, and concats with the object is a list of the same type and appends if the object can be a member of the list.</p>