Just for review, can someone quickly explain what prevents this from working (on compile):

private HashSet data;

...

public DataObject[] getDataObjects( )
{
    return (DataObject[]) data.toArray();
}

...and what makes this the way that DOES work:

public DataObject[] getDataObjects( )
{
    return (DataObject[]) data.toArray( new DataObject[ Data.size() ] );
}

I'm not clear on the mechanism at work with casting (or whatever it is) that makes this so.

Edit
Report