简体   繁体   中英

Generic programming in Java source code

Arrays and Collections are two basic api classes used by all java programmers. Both the classes were added in Java 1.2

Looking at Arrays class, there are 27 overloaded binarysearch methods and it has no usage of Generics where as collections is updated to use generics. Where as Collections class has 2 overloaded binary search methods.

Any reason why it is done this way or am i missing any thing?

Because Java generics can only be parameterised on reference types. int , long , etc. are primitive types.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM