Hi folks,

there's one comparator I've been missing from the commons-collection: a
comparator that uses a specified bean property of objects to perform the
comparisons.

Basically, it works like this: if you construct an instance with:

Comparator c =
  new BeanPropertyComparator(Customer.class, "birthDate");

c will use the natural ordering on the values of Customer.getBirthDate() to
compare Customer objects.

There's an alternative constructor to specify an embedded comparator for
comparing the retrieved property values:

Comparator c =
    new BeanPropertyComparator(
       Customer.class, "birthDate", new ReverseComparator());

Admittedly, the class is fairly trivial, but I already have it implemented
and tested - would the project be interested in the contribution?

Attila.




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to