官术网_书友最值得收藏!

How it works...

At the heart of generics lies the ability to reuse a single class or method. It allows developers to essentially not repeat similar code throughout your code base. This conforms well to the Don't Repeat Yourself (DRY) principle. This design principle states that a specific bit of logic should be represented in code only once.

Using generic classes, for example, also allows developers to create a class that is type safe when compiling. Type safe basically means that the developer can be assured of the type of the object and can use the class in a specific way without experiencing any unexpected behavior. Therefore, the compiler takes over the burden of type safety.

Generics also allow developers to write less code, because code can be reused and less code also performs better.

主站蜘蛛池模板: 咸阳市| 科技| 乌审旗| 滕州市| 汉寿县| 岱山县| 凤山市| 屏山县| 栖霞市| 工布江达县| 临潭县| 西华县| 河津市| 延津县| 达日县| 积石山| 柘荣县| 黔西县| 平塘县| 岐山县| 西青区| 东阿县| 灵山县| 加查县| 合作市| 德庆县| 枣阳市| 周口市| 岗巴县| 霍城县| 忻州市| 竹北市| 定日县| 南雄市| 花垣县| 临沂市| 邵武市| 壶关县| 和政县| 定远县| 拉萨市|