bolson: (Default)
Java's generics are hard. And I think they're defined wrong.
HashMap<String,String>[] arrayOfHashMap; // Ok, I can declare this
arrayOfHashMap[0] = new HashMap<String,String>(); // this compiles just fine
HashMap<String,String> instanceOfHashMap = arrayOfHashMap[0]; // this works fine in code too
arrayOfHashMap = new HashMap<String,String>[]; // but this always is a compiler error!
arrayOfHashMap = new HashMap[]; // and this is a warning! I can't win!

This is clearly a bug in the design of the language.

Also, ObjectInputStream.readObject(), which returns Object, appears to have no way of assigning to a templated type without warning without adding the annotation @SuppressWarnings({"unchecked"}) to the function. Hmpf. Shoulda stuck with Java 1.4
bolson: (Default)
Developing a Java Servlet webapp with DB back-end in parallel for portability between PostgreSQL, MySQL and Derby (and I'd be using Oracle too if their free demo worked on Mac). I don't know what it is about these exercises I find so engaging, but I do it anyway.

Profile

bolson: (Default)
bolson

May 2017

S M T W T F S
 123456
78 910111213
14151617181920
21222324252627
28293031   

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 23rd, 2017 10:38 am
Powered by Dreamwidth Studios