▁Scala ' s ▁rules ▁for ▁checking ▁variance ▁annotations ▁are ▁essentially ▁the ▁same ▁as ▁C # ' s . ▁However , ▁there ▁are ▁some ▁id i oms ▁that ▁apply ▁to ▁imm utable ▁datas tr uct ures ▁in ▁particular . ▁They ▁are ▁illustrated ▁by ▁the ▁following ▁( ex cer pt ▁from ▁the ) ▁definition ▁of ▁the ▁List [ A ] ▁class . ▁ ▁se aled ▁abstract ▁class ▁List [ + A ] ▁extends ▁Abstract Seq [ A ] ▁{ ▁▁▁▁ ▁def ▁head : ▁A ▁▁▁▁ ▁def ▁tail : ▁List [ A ] ▁▁▁▁▁ ▁/** ▁Add s ▁an ▁element ▁at ▁the ▁beginning ▁of ▁this ▁list . ▁*/ ▁▁▁▁ ▁def ▁:: [ B ▁> : ▁A ] ▁( x : ▁B ): ▁List [ B ] ▁= ▁▁▁▁▁▁▁▁ ▁new ▁scala . collection . im mutable . :: ( x , ▁this ) ▁▁▁▁ ▁/** ▁... ▁*/ ▁} ▁ ▁First , ▁class ▁members ▁that ▁have ▁a ▁variant ▁type ▁must ▁be ▁imm utable . ▁Here , ▁head ▁has ▁the ▁type ▁A , ▁which ▁was ▁declared ▁cov ari ant ▁(+ ), ▁and ▁indeed ▁head ▁was ▁declared ▁as ▁a ▁method ▁( def ). ▁Trying ▁to ▁declare ▁it ▁as ▁a ▁mutable ▁field ▁( var ) ▁would ▁be ▁rejected ▁as ▁type ▁error . ▁ ▁Second , ▁even ▁if ▁a ▁data ▁structure ▁is ▁imm utable , ▁it ▁will ▁often ▁have ▁methods ▁where ▁the ▁parameter ▁type ▁occurs ▁cont rav ari antly . ▁For ▁example , ▁consider ▁the ▁method ▁:: ▁which ▁adds ▁an ▁element ▁to ▁the ▁front ▁of ▁a ▁list . ▁( The ▁implementation ▁works ▁by