S Fox wrote:I have a class that I made which is like a custom data-type, and I'm trying to figure out how to tell java what makes each object unique for the purposes of adding them into a Set? Right now it's just adding everything.
I wanted to compare the objects by a String "name" for deciding the set membership.
Paul Clapham wrote:...maybe you could call that "recovering" anyway? I guess my point is that when an FTP exception happens, then having the application end abnormally isn't our preferred outcome. We would prefer to note that the exception happened, perhaps do something differently, but at any rate we want the application to continue on in a normal way...
Junilu Lacar wrote:The main thing to watch for, IMO, is copping out or worse, being lazy about checked exceptions. If you automatically wrap a checked exception with an unchecked exception and throw it back upstairs, then you have to ask if that's the right thing to do or if you're just being lazy and doing it for the sake of short-term expediency at the cost of long-term robustness of your design.
Junilu Lacar wrote:Scott Shipp... you wouldn't happen to be the author of this article, would you? Just wondering because I had a discussion just in the past few days with someone off-Ranch about what you wrote there. Nothing bad, I assure you. The guy I was talking to was thinking about expanding on some of your points and he and I had a discussion about working on a follow-up article together.
Stephan van Hulst wrote:It would be silly for a utility class for array operations, not to work on arrays.
String is an extremely low level data structure. It's not a good example of a high level application API.
Stephan van Hulst wrote:Arrays are not good for APIs. They're basic building blocks of more advanced data structures. Whether a method is private or not doesn't matter. You're still a consumer of your own private methods, and collections are much more versatile and lead to code that's easier to read. Performance will rarely play a part, because collections that use an array as their backing store (ArrayList, ArrayDeque, ArrayBlockingQueue) shouldn't perform that much poorer.
There might be some caveats, but those will be known by software architects who have a very specific and well thought out reason to use an array instead of a collection, and only after profiling. If you're not sure you need one, then you don't need one.