Generic programming: Difference between revisions

Content deleted Content added
WikiCleanerBot (talk | contribs)
m v2.05b - Bot T20 CW#61 - Fix errors for CW project (Reference before punctuation - Link equal to linktext)
sfn fix.
Line 377:
{{Main article|Generics in Java}}
 
Support for the ''generics'', or "containers-of-type-T" was added to the [[Java (programming language)|Java programming language]] in 2004 as part of J2SE 5.0. In Java, generics are only checked at compile time for type correctness. The generic type information is then removed via a process called [[type erasure]], to maintain compatibility with old [[Java virtual machine|JVM]] implementations, making it unavailable at runtime.<ref name=Bloch>{{cite book sfn| title= "Effective Java: Programming Language Guide" |last=Bloch| first=Joshua2018| publisherloc=Addison-Wesley§Item |28: edition=thirdPrefer |lists to isbn=978-0134685991arrays| yearp=2018}}</ref>{{rp|126}} For example, a <code>List&lt;String&gt;</code> is converted to the raw type <code>List</code>. The compiler inserts [[Type conversion|type casts]] to convert the elements to the <code>String</code> type when they are retrieved from the list, reducing performance compared to other implementations such as C++ templates.
 
====Genericity in .NET [C#, VB.NET]====