Generics of primitives

at 2010-08-10 in Examples5.8-SERIES by friebe (0 comments)

Like in C# (and unlike Java), primitives can be used as components of generics in the 5.8-SERIES. Given a vector util.collections.Vector<string>, the following applies:

  // OK
$v[]= "Hello";

// Throws a lang.IllegalArgumentException
$v[]= 1;

Primitives can also be used in other generic collections types, e.g. Set and Map implementations as well as Stack and Queue.



Subscribe

You can subscribe to the XP framework's news by using RSS syndication.


Categories

News
General
PHP5
Announcements
RFCs
Further reading
Examples
Editorial
EASC
Experiments
Unittests
Databases
5.8-SERIES
Unicode
Language
5.9-SERIES

Related

Find related articles by a search for «Generics».