Skip to content

Deep in Code

Take a deep dive into code

Monthly Archives: December 2006

Understanding Generics with Collections

In Java (prior to 5.0), a lot of times you are compelled to downcast your object to a more specific one. For example, when you add a String to a List, and when you want to retrieve your String back then you need to downcast. List myList = new ArrayList(); myList.add(“abc”); String str = (String)myList.get(0); […]

Posted byDeepak AnupalliDec 22, 2006May 17, 2020Posted inJava57 Comments on Understanding Generics with Collections

Bootstrapping static fields within enums

In my earlier post on enums in Java 5, we have seen that static fields cannot be accessed within the enum constructor. With this restriction we could run into few initialization problems discussed below. The other day Rajiv found it difficult to initialize a static cache during enum bootstrap. The following is his enum: public […]

Posted byDeepak AnupalliDec 8, 2006May 17, 2020Posted inJava57 Comments on Bootstrapping static fields within enums

RSS RSS Feed

  • Amazon SimpleDB Developer Guide by PACKT
  • Playing around with exception stack traces
  • Improper use of Generics could breach type safety
  • Understanding Generics with Collections
  • Bootstrapping static fields within enums
  • Type Safe Enumerations in Java 5.0

Archives

  • July 2010
  • August 2007
  • March 2007
  • December 2006
  • November 2006

Categories

  • Cloud
  • Java
  • Java5
Deep in Code, Proudly powered by WordPress.