Meaningless Drivel is fun!
The moose likes Beginning Java and the fly likes Trouble with ADT lists Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Trouble with ADT lists" Watch "Trouble with ADT lists" New topic

Trouble with ADT lists

Jarom Knudsen

Joined: Oct 14, 2010
Posts: 3
I've been tinkering around seemingly all day at trying to figure this bit out. The assignment is to make a bag like ADT list. Then, make it so if I have two such lists, they can compare the entries in each other and make a third "bag" into which contents of equal or differing values can be placed. Anyways, I'm at the point marked with all the exclamation marks in For some annoying (and certainly very noobish) reason, it keeps saying that the value to be returned is a String instead of a generic type object. I'm rather new to java and would like all the help I can get to figure this out! Thanks!



If you see anything else I'm doing wrong or think I should do instead, please tell me! Thank you again!
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46368
Style problems: That interface ought not to have its comments marked //, but they should be documentation comments with /** ... */
That isSame method does not return whether the two values are the same. If you are using objects, you should writeDon't use the compareTo method unless you are certain it is consistent with equals. Don't writeif (...) return true; else return false;
I agree. Here's the link:
subject: Trouble with ADT lists
It's not a secret anymore!