Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trouble with ADT lists

 
Jarom Knudsen
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 AList.java. 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
Sheriff
Pie
Posts: 50196
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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;
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic