Download e-book for iPad: Java generics and collections by Maurice Naftalin

By Maurice Naftalin

ISBN-10: 0596527756

ISBN-13: 9780596527754

This accomplished consultant indicates you ways to grasp the main importantchanges to Java because it was once first published. Generics and the greatlyexpanded assortment libraries have vastly elevated the ability ofJava five and Java 6. yet they've got additionally careworn many builders whohaven't recognized the way to make the most of those new features.

Java Generics and Collections covers every thing from the mostbasic makes use of of generics to the strangest nook circumstances. It teaches youeverything you must find out about the collections libraries, so you'llalways understand which assortment is suitable for any given job, andhow to take advantage of it.

Topics lined include:

  • Fundamentals of generics: kind parameters and primary methods
  • Other new good points: boxing and unboxing, foreach loops, varargs
  • Subtyping and wildcards
  • Evolution no longer revolution: time-honored libraries with legacy consumers andgeneric consumers with legacy libraries
  • Generics and reflection
  • Design styles for generics
  • Sets, Queues, Lists, Maps, and their implementations
  • Concurrent programming and thread security with collections
  • Performance implications of other collections

Generics and the recent assortment libraries they encouraged take Java to anew point. that will take your software program improvement perform toa new point, this booklet is vital reading.

Philip Wadler is Professor of Theoretical computing device technology at theUniversity of Edinburgh, the place his learn makes a speciality of the layout ofprogramming languages. he's a co-designer of GJ, paintings thatbecame the root for generics in Sun's Java 5.0.

Maurice Naftalin is Technical Director at Morningside gentle Ltd., a software program consultancy within the uk. He has such a lot lately served as an architect and mentor at NSB Retail structures plc, and because the chief of the buyer improvement workforce of a big united kingdom govt social provider system.

"A fantastic exposition of generics. by way of a long way the simplest booklet on thetopic, it presents a crystal transparent instructional that starts off with thebasics and ends leaving the reader with a deep knowing of boththe use and layout of generics."
Gilad Bracha, Java Generics Lead, solar Microsystems

Show description

Read or Download Java generics and collections PDF

Best object-oriented design books

New PDF release: Java Design: Objects, UML, and Process

Software program designers, builders, and designers are continually faced with an identical confounding challenge: how one can layout software program that's either versatile and resilient amid switch. to complete this tall activity, practitioners needs to make the most of the simplest to be had applied sciences to the fullest. JavaT layout is dependent upon a mix of top practices and best-of-breed applied sciences to create a transparent and concise advisor to development fine quality, lasting software program designs.

Get Moodle 1.9 Top Extensions Cookbook PDF

The disorganised array of modules on hand for Moodle are introduced jointly in methods you could relate to. reports contain information that can assist you come to a decision if a module is worthy checking out. There are illustrated, step by step publications to fitting and configuring modules. while you're curious about instructing utilizing Moodle, be it at really small associations working their very own Moodle example, or at huge associations the place Moodle is used and administered, otherwise you are an administrator of a Moodle example who's trying to find modules that may be precious to academics and scholars at their establishment, this booklet is intended for you.

Get Java generics and collections PDF

This complete advisor exhibits you the way to grasp the main importantchanges to Java because it was once first published. Generics and the greatlyexpanded assortment libraries have vastly elevated the facility ofJava five and Java 6. yet they've got additionally burdened many builders whohaven't recognized how one can reap the benefits of those new beneficial properties.

Get Object Oriented Simulation: A Modeling and Programming PDF

Item orientated SimulationJosé GarridoAbout this textbook:Object orientated Simulation will qualify as a important source to scholars and comprehensive execs and researchers alike, because it presents an in depth, but understandable advent to the fundamental rules of object-oriented modeling, layout and implementation of simulation types.

Additional info for Java generics and collections

Example text

7. Bridges As we mentioned earlier, generics are implemented by erasure: when you write code with generics, it compiles in almost exactly the same way as the code you would have written without generics. In the case of a parameterized interface such as Comparable, this may cause additional methods to be inserted by the compiler; these additional methods are called bridges. 6 shows the Comparable interface and a simplified version of the Integer class in Java before generics. In the nongeneric interface, the compareTo method takes an argument of type Object.

2. Maximum of a Collection In this section, we show how to use the Comparable interface to find the maximum element in a collection. We begin with a simplified version. The actual version found in the Collections Framework has a type signature that is a bit more complicated, and later we will see why. 4. For instance, the method asList takes an array of type E[] and returns a result of type List, and does so for any type E. Here we have a generic method that declares a bound on the type variable.

Now any two fruits are compared by ignoring their names and comparing their sizes. Since Fruit implements Comparable, any two fruits may be compared. Now the test code can find the maximum of all three lists, including the one that mixes apples with oranges. Recall that at the end of the previous section we extended the type signature of compareTo to use super: > T max(Collection coll) The second example shows why this wildcard is needed. If we want to compare two oranges, we take T in the preceding code to be Orange: Orange extends Comparable

Download PDF sample

Java generics and collections by Maurice Naftalin


by James
4.0

Rated 4.56 of 5 – based on 37 votes