0

I am following a free google appengine programming course at udacity (Developing Scalable Apps In java, a pretty good introductory course to appengine by the way).

In one of the lessons, I get to this sample piece of java code:

...
// Iterate over keyStringsToAttend and return a Collection of the
// Conference entities that the user has registered to attend
List< Key<Conference> > keysToAttend = new ArrayList<>();
for ( String keyString : keyStringsToAttend ) {
      keysToAttend.add( Key.<Conference>create( keyString ) );
}
...

My question is about the last statement in the fragment:

Key.<Conference>create( keyString )

The syntax is correct, it compiles and runs perfectly, but I just don't get the meaning of the .<Conference> part before the create(...) method name... Can you explain this syntax?

Sotirios Delimanolis
  • 274,122
  • 60
  • 696
  • 724
Alex Mera
  • 3
  • 2

1 Answers1

0

The create method accepts generic parameter, so the parameter type was passed.

you can read more about generic parameters here

Sunil Rajashekar
  • 350
  • 2
  • 18
  • Thanks Sunil, useful answer! As you may guess, I am quite new to java. I have a good background on C++, which has a similar syntax for generics. Similar... but not equal! – Alex Mera May 20 '15 at 13:53