jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Müller <thomas.muel...@day.com>
Subject Re: Generics generator class
Date Wed, 06 May 2009 10:35:35 GMT

> I do care about performance, so yes, I'd like so see numbers.

My test case is:

public static void main(String[] args) {
    for (int i = 0; i < 3; i++) {
        long start = System.currentTimeMillis();
        ArrayList list = new ArrayList();
        for (int j = 0; j < 1000000000; j++) {
        System.out.println(System.currentTimeMillis() - start);

With JDK 1.5 (Mac OS X): ArrayList declaration: 3028 List declaration: 8037

But I agree it's almost never really an issue. Most performance
problems are not related to this.

> Bloch advises to use interfaces in Effective Java, 2nd edition, Item 52.

In Effective Java, first edition, it's issue 34, page 156: "Refer to
objects by their interfaces - If appropriate interfaces exist,
parameters, returns values, variables, and fields should all be
declared using interface types". ... "could be changed ... and all of
the surrounding code would continue to work"

I do agree to this, except for variables and private fields that don't
affect the surrounding code.


View raw message