Angelika Langer - Training & Consulting
HOME | COURSES | TALKS | ARTICLES | GENERICS | LAMBDAS | IOSTREAMS | ABOUT | NEWSLETTER | CONTACT | Twitter | Lanyrd | Linkedin
HOME 


  UPCOMING
  PREVIOUS
  MATERIALS
 
GENERICS 
LAMBDAS 
IOSTREAMS 
ABOUT 
NEWSLETTER 
CONTACT 
Java Generics - A Mob Programming Session

Java Generics - A Mob Programming Session  
ABSTRACT
 
 
Java 5.0 added generic types and methods to the language, collectively known as Java Generics.  Generics are a widely debated new language feature, mainly because they are amazingly complex, at least more complex as most people had expected. 

The key concepts of Java Generics are easy to grasp: parameterize a type with a type variable, et voilà, the result is a generic type. Likewise for generic methods. An example of a generic type is the generic interface List<E> {...} which can be used to form parameterized types such as List<String> or List<Double> , but also List<? extends Number> , which involves use of a wildcard.  Wildcards are probably the most difficult-to-grasp element of Java Generics. Yet, they are everything but syntactic sugar.  Quite the converse, they are frequently needed as argument types of carefully crafted methods. An example is <T> void sort(List<T> list,Comparator<? super T> c) in class java.util.Collections .  The " ? super T "-wildcard is needed, because the method would otherwise mistakenly prevent sorting a List<Double> with a Comparator<Number> .

In this session we will give a brief recap of the key concepts of Java Generics and all involved syntax elements. Then we, as a mob, will program using Java generics.  The idea is the following: the presenter sets up a programming task, the attendants suggest the source code, the presenter types it in, and then we'll see what happens.  It's a unique opportunity to learn everything you always wanted to know about generics (but were afraid to ask) and to step into every known pitfall (that a novice to generics typically steps into).

 
PREREQUISITES

 
Level: intermediate / advanced
Duration: 1.5 - 3.0 hours
Prerequisites: Attendants should be familiar with Java.Knowledge of Java generics is helpful, but not strictly required.
Presented at: JAX 2006 , Frankfurt, Germany, May 2006

 

If you are interested to hear more about this and related topics you might want to check out the following seminar or skim through some further reading:
Seminars
 
Effective Java
4 day seminar (open enrollment and on-site)

 

Articles
 
online FAQ Java Generics FAQ
Online FAQ
article Language Features of Java Generics
Article

 

 


 
  © Copyright 1995-2012 by Angelika Langer.  All Rights Reserved.    URL: < http://www.AngelikaLanger.com/Conferences/Abstracts/GenericsMobProgramming.htm  last update: 4 Nov 2012