| Issue |
Subject |
Date |
| 186
|
Iterator Quiz
Most of the northern hemisphere is on holiday, so here is a quick quiz for those poor souls left behind manning the email desk. How can we prevent a ConcurrentModificationException in the iterator?
|
2010-07-30
|
| 178b
|
WalkingCollection Generics
Generics can be used to further improve the WalkingCollection, shown in our previous newsletter.
|
2009-11-17
|
| 177
|
Logging Part 3 of 3
After almost nine years of silence, we come back to bring the logging series to an end, looking at best practices and what performance measurements to log.
|
2009-10-13
|
| 168
|
The Delegator
In this newsletter we show the reflection plumbing needed for writing a socket monitor that sniffs all the bytes being sent or received over all the Java sockets. The Delegator is used to invoke corresponding methods through some elegant guesswork.
|
2009-01-15
|
| 167
|
Annotation Processing Tool
In this newsletter we answer the question: "How do we force all subclasses to contain a public no-args constructor?" The Annotation Processing Tool allows us to check conditions like this at compile time, rather than only at runtime.
|
2008-12-05
|
| 161
|
Of Hacking Enums and Modifying "final static" Fields
The developers of the Java language tried their best to stop us from constructing our own enum instances. However, for testing purposes, it can be useful to temporarily add new enum instances to the system. In this newsletter we show how we can do this using the classes in sun.reflect. In addition, we use a similar technique to modify static final fields, which we need to do if we want the switch statements to still work with our new enums.
|
2008-05-23
|
| 141
|
Hacking Enums
Enums are implemented as constant flyweights. You cannot construct them. You cannot clone them. You cannot make copies with serialization. But here is a way we can make new ones in Java 5.
|
2007-03-13
|
| 127
|
Casting like a Tiger
Java 5 adds a new way of casting that does not show compiler warnings or errors. Yet another way to shoot yourself in the foot?
|
2006-06-07
|
| 126
|
Proxy equals()
When we make proxies that wrap objects, we have to remember to write an appropriate equals() method. Instead of comparing on object level, we need to either compare on interface level or use a workaround to achieve the comparisons on the object level, described in this newsletter.
|
2006-05-14
|
| 123
|
Strategy Pattern with Generics
The Strategy Pattern is elegant in its simplicity. With this pattern, we should try to convert intrinsic state to extrinsic, to allow sharing of strategy objects. It gets tricky when each strategy object needs a different set of information in order to do its work. In this newsletter, we look at how we can use Java 5 Generics to pass the correct subtype of the context into each strategy object.
|
2006-03-14
|
| 121
|
How Deep is Your Hierarchy?
Someone asked me yesterday what the maximum inheritance depth is in Java. I guessed a value of 65535, but for practical purposes, not more than 5. When I asked performance guru Kirk Pepperdine to estimate, he shot back with 63. In this newsletter, we look at the limitations in the JVM and examine some existing classes.
|
2006-02-14
|
| 120
|
Exceptions From Constructors
What do you do when an object cannot be properly constructed? In this newsletter, we look at a few options that are used and discuss what would be best. Based on the experiences of writing the Sun Certified Programmer for Java 5 exam.
|
2006-02-08
|
| 117
|
Reflectively Calling Inner Class Methods
Sometimes frameworks use reflection to call
methods. Depending how they find the correct method to
call, we may end up with IllegalAccessExceptions. The
naive approach of clazz.getMethod(name) is not correct
when we send instances of non-public classes.
|
2005-12-02
|
| 114
|
Compile-time String Constant Quiz
When we change libraries, we need to do a full recompile of our code, in
case any constants were inlined by the compiler. Find out which constants
are inlined in this latest newsletter.
|
2005-09-16
|
| 113
|
Enum Inversion Problem
A problem that I encountered when I first started using enums was how
to serialize them to some persistent store. My initial approach was to
write the ordinal to the database. In this newsletter, I explore some
ideas of a more robust approach. It will also show you some applications
of Java generics.
|
2005-08-29
|
| 110
|
Break to Labeled Statement
|
2005-06-30
|
| 109
|
Strategy Pattern of HashCode Equality
|
2005-05-18
|
| 108
|
Object Adapter based on Dynamic Proxy
|
2005-05-10
|
| 107
|
Making Enumerations Iterable
|
2005-04-19
|
| 103
|
New for/in loop gymnastics
|
2005-02-07
|
| 102
|
Mangling Integers
|
2005-01-31
|
| 097
|
Mapping Objects to XML Files using Java 5 Annotations
|
2004-10-17
|
| 096
|
Java 5 - "final" is not final anymore
|
2004-10-07
|
| 095b
|
Follow-up: Self-reloading XML Property Files
|
2004-10-01
|
| 095
|
Self-reloading XML Property Files
|
2004-09-30
|
| 094
|
Java Field Initialisation
|
2004-09-20
|
| 087
|
sun.reflect.Reflection
|
2004-04-09
|
| 084
|
Ego Tripping with Webservices
|
2004-02-05
|
| 083
|
End of Year Puzzle
|
2003-12-26
|
| 083b
|
End of Year Puzzle Follow-up
|
2003-12-26
|
| 080
|
Many Public Classes in One File
|
2003-10-13
|
| 079
|
Generic toString()
|
2003-10-08
|
| 076
|
Asserting Locks
|
2003-08-05
|
| 073
|
LinkedHashMap is Actually Quite Useful
|
2003-06-22
|
| 072
|
Java and Dilbert
|
2003-06-15
|
| 071
|
Overloading considered Harmful
|
2003-06-01
|
| 067
|
BASIC Java
|
2003-03-31
|
| 063
|
Revisiting Stack Trace Decoding
|
2003-01-28
|
| 062b
|
Follow-up and Happy New Year!
|
2002-12-31
|
| 062
|
The link to the outer class
|
2002-12-27
|
| 056
|
Shutting down threads cleanly
|
2002-09-16
|
| 055
|
Once upon an Oak ...
|
2002-08-26
|
| 050
|
Commenting out your code?
|
2002-06-10
|
| 047
|
Lack of Streaming leads to Screaming
|
2002-05-24
|
| 043
|
Arrgh, someone wants to kill me!
|
2002-03-11
|
| 040
|
Visiting your Collection's Elements
|
2002-01-31
|
| 036
|
Using Unicode Variable Names
|
2001-11-23
|
| 034
|
Generic Types with Dynamic Decorators
|
2001-10-24
|
| 032
|
Exceptional Constructors - Resurrecting the dead
|
2001-10-11
|
| 031
|
Hash, hash, away it goes!
When I first started using Java in 1997, I needed very large hash tables for matching records as quickly as possible. We ran into trouble when some of the keys were mutable and ended up disappearing from the table, and then reappearing again later.
|
2001-09-26
|
| 028
|
Multicasting in Java
|
2001-08-14
|
| 026
|
Package Versioning
|
2001-07-25
|
| 025
|
Final Newsletter
|
2001-07-12
|
| 022
|
Classloaders Revisited: "Hotdeploy"
|
2001-06-07
|
| 021
|
Non-virtual Methods in Java
|
2001-05-31
|
| 020
|
Serializing Objects Into Database
|
2001-05-24
|
| 018
|
Class names don't identify a class
|
2001-05-03
|
| 017b
|
Follow-up
|
2001-04-28
|
| 017a
|
Switching on Object Handles
|
2001-04-26
|
| 014
|
Insane Strings
|
2001-03-21
|
| 011
|
Hooking into the shutdown call
|
2001-02-28
|
| 009
|
Depth-first Polymorphism
|
2001-02-15
|
| 008
|
boolean comparisons
|
2001-02-08
|
| 006
|
Implementation code inside interfaces
|
2001-01-25
|
| 005
|
Dynamic Proxies - Short Tutorial
|
2001-01-18
|
| 004
|
Logging part 2
|
2001-01-11
|
| 003
|
Logging part 1
|
2000-12-14
|
| 002
|
Anonymous Inner Classes
|
2000-12-07
|