commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <>
Subject Re: [collection] Collections for primitives
Date Tue, 25 Jun 2002 18:28:22 GMT
From: "Michael A. Smith" <>
> > Hm.  Based on what I've just said, it might be defensible for the
> > Predicate and primitive collections to remain as they are.  For
> > the primitive case, it's always exceptional to pass in a non-primitive;
> > but for the predicate case, it may or may not be exceptional to pass
> > in a value that fails the predicate.  Hence the different behaviors.
> my point exactly.  :)

I just find this pesky. My use case revolves around me not knowing that its
a primitive collection that I'm querying.

List list = new IntArrayList();
if (checkForFriendlyLists(list)) {
  // do something

public boolean checkForFriendlyLists(List list) {
    return list.contains("Hello!");

This is very contrived, I know. But the point is that the second method
might not have been written by you. Its not going to be expecting a
ClassCastException, and thus might not handle it.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message