:: . , x :: xs List[ commonSupertypeOf[ typeOf[x], elementTypeOf[xs] ] ] ( scala, , ), xs. xs List[Float] x Integer, x :: xs List[Numeric], xs List[Float], .
add, , . xs.add(x) Integer a Stack, Stack<Float>, .
, x :: xs . , , typeckecks:
:: a List[A] : def :: [B >: A] (x: B) : List[B].
, A B, B A, :: B, A B. , someInteger :: someFloats, , B is Numeric A is Float, .
java-, <B supertypeOf A> List<B> prepend(B item), , supertypeOf java.