|
Post by EurasianVixen on Jan 16, 2002 21:47:03 GMT -5
Say when the user types "list" when running A1Driver, which then calls a method from URLList. It will then have to return the elements stored in that ArrayList back to A1Driver and then be printed onto the screen. Does anyone know how to return an ArrayList from URLList class to A1Driver class?
|
|
|
Post by Sylph on Jan 16, 2002 23:11:13 GMT -5
probably uses Iterator, as stated in the handout.
|
|
|
Post by 1.8T on Jan 16, 2002 23:31:37 GMT -5
question:.., did we learn dynamic arrays??
i prob asked this question b4., but i forgot.,..,., yeah that mat137 test kinda messed me up.., anywys..,
u guys doing this with arrays or vectors??., and if its arrays., are u guys doing it with dynamic arrays?. cuz i have no idea how to make arrays without predefining its size..,
|
|
Linksys
Junior Member
Kenshin: It doesn't matter. Use whatever technique you like. However. Once I've said I'll kill you,
Posts: 12
|
Post by Linksys on Jan 17, 2002 17:11:51 GMT -5
It says to use ArrayList or Vectors. ArrayList is different from regular Array's it works like a Vector. So you don't have to worry about changing the size of it.
|
|
|
Post by 1.8T on Jan 17, 2002 18:49:37 GMT -5
It says to use ArrayList or Vectors. ArrayList is different from regular Array's it works like a Vector. So you don't have to worry about changing the size of it. wut's an ArrayList?.. is it like a dynamic array?. if so ., how do we use it?.,. any suggestoins where i can read up so i know how to use this instead of vectors?.,. cuz i don't think we were taught this
|
|
|
Post by Sylph on Jan 17, 2002 19:06:31 GMT -5
the API?
|
|
|
Post by EurasianVixen on Jan 17, 2002 19:26:12 GMT -5
How would u use an Iterator in the A1Driver? Wouldn't the Iterator be found in the URLList? And therefore, how do you return information about an ArrayList (say, when the user types "List") back to the A1Driver without having to mention anything about an ArrayList? Geez, I can't believe they're making us use these dynamic arrays (which we have never done) and vectors (which was so briefly covered in 108 but without an assignment or tutorial excercise ...)
|
|
|
Post by 1.8T on Jan 17, 2002 20:47:49 GMT -5
the API? oh i almost forgot about that.,., thx., hmmm., seeing all these posts about the assignment.,., i really think i should get my act together and start the assignment.,., but i'm too sick too,.., stupid weather.,., its sooo colddddddddddd.,.,., worse thing is.,., its like fall weather at st.george., but when i get back up north where i live,.., its SNOW + SNOW + ICE =CRAPPY DRIVING
|
|
|
Post by CooLiBoP on Jan 19, 2002 17:04:59 GMT -5
Well what I did (because I don't know about Iterator's 'n stuff) was create a new URLList object in my a1driver for now and just called the methods that way...I guess when I figure out the Iterator stuff I'll just modify it
|
|
|
Post by Observer on Jan 19, 2002 18:39:51 GMT -5
#5 of the 'Vital Rules' says that A1Driver must not mention any predefined List type, it can only use an instance of URL list. So would what CooLiBoP is doing (currently) be okay or not? I'm guessing not since he's predefining a list type in A1Driver...
Btw, I have no better idea and I'm not trying to single out CooL or anything like that, just wondering.
|
|
|
Post by Sky on Jan 19, 2002 19:35:03 GMT -5
i think CooliBop is correct...we are suppose to create an object of URLList in A1Driver and use URLList's method in A1Driver...or else when are we going to use the URLList class? as it stated in vital rule #5 "...it can only use instances of URLList"
but of course...u can't return any list type (like vector or array that containing the list) in any of the methods in URLList
|
|
|
Post by Observer on Jan 19, 2002 20:26:36 GMT -5
I am changing my mind, sorry about that. Sky opened my eyes a bit, since he's only creating an instance of URLList w/o stating predefined types like vector it's okay.
|
|
|
Post by CooLiBoP on Jan 19, 2002 21:18:17 GMT -5
Basically I've created an empty constructor ... I can't think of anything that would go in there
public URLList(){ }
Is that what I'm supposed to do?
|
|
|
Post by Sylph on Jan 19, 2002 22:43:06 GMT -5
u don't have to make a constructor, remember! if u don't do anything, it's automatically like an empty constructor: URLList urllist = new URLList();
|
|
|
Post by Observer on Jan 20, 2002 1:56:04 GMT -5
Does anyone know the answer to the original question? I've been stuck for the last couple or so hours trying to figure out how to get the 'list' command to work. Add and size are a piece of cake but since URLList can only return one thing in each method and I'm having trouble with 'list' since using a loop in any method in URLList won't work. The built in vector methods are uselss here too.
(MODIFY) ---Nevermind, I think I've got it.
|
|