- java parameterized generic type is known (generics). Usually see the most generic applications are in each set, such as ArrayList, HashMap in.
- c ++ using the generic inflation method, is implemented to generate a plurality of classes. And erasing method using a java, the object is stored is erased Object type, but once again according to the corresponding type cast upon removal.
Below an example saying ArrayList source erase method:
transient Object [] elementData of; // when depositing the E type to store Object public Boolean the Add (E E) { ensureCapacityInternal (size +. 1 ); elementData of [size ++] = E; return to true ; } // when removing Object and then into the corresponding E type strong public E GET ( int index) { rangeCheck (index); return elementData of (index); } E elementData of ( int index) { return (E) elementData of [index]; }