Steven Mann wrote:Were you guys rooting for Watson in Jeopardy. How do you feel about him winning? - Steven
Stuart McCulloch wrote:
The Maven Appendix contains examples for building various sorts of OSGi bundles, but it's not a general guide to Maven. If you want to teach yourself Maven from scratch then I can recommend the free books from Sonatype http://www.sonatype.com/books/maven-book/ (disclaimer: I work for Sonatype).
Stuart McCulloch wrote:
Unfortunately we didn't have enough space to cover Eclipse RCP, but there are plenty of good RCP books around. However a lot of the concepts and best-practices in the book can be used when building RCP applications and Eclipse plugins. The Maven Appendix covers building applications with the maven-bundle-plugin (we tend to use bnd for examples in the book).
Rob Spoor wrote:But you're not calling sprites.get("play.png"), you're calling sprites.get("name").
Rob Spoor wrote:
Are you sure that sprites.containsKey("play.png") returns true? In other words, that sprites.get("play.png") does not return null?
You are calling sprites.get("name") - using the String literal "name" instead of the parameter name. As a results, the returned Image probably is null.
lscolton@Workstation:~/Desktop$ javac Main.java
lscolton@Workstation:~/Desktop$ java Main
[one, two, three, 4, 5, 6]
one
two
three
Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
at Main.main(Main.java:14)
Mike Simmons wrote:
The key is the double cast on line 4. The cast to raw List causes the compiler to forget the generic parameter <Object> entirely. And the cast to List<String> tells the compiler it has a new generic parameter, <String>. Casting to and from raw types would generate a warning, so using @SuppressWarnings is nice to tell the compiler to shut up about that.
Mike Simmons wrote:
For fun, try predicting what will happen with the following code. Will it compile? Will it run? Exactly what line will the error (compilation error or runtime exception) occur on? Why?
After trying to decide in advance what the answer is, try it and see. Compile it and run it (if possible), and see what happens. Was it what you expected?