By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,200 Members | 1,627 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,200 IT Pros & Developers. It's quick & easy.

What kind of linked-list generic do they mean?

P: n/a
Hello!

What actually does this sentence mean?
Create a linked-list generic class that enables you to create a chain of
different objects types.

When I create a linked-list generic class for example with the string type.
I do the following.
List<stringmyList = new List<string>();

So what can they mean when they say different objects types.

Does it sounds reasonable that they mean a linked-list of object like this
List<ObjectmyList = new List<Object>();

//Tony
Oct 16 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Thu, 16 Oct 2008 11:53:17 -0700, Tony Johansson
<jo*****************@telia.comwrote:
What actually does this sentence mean?
Create a linked-list generic class that enables you to create a chain of
different objects types.
Impossible to say for sure without more context.
When I create a linked-list generic class for example with the string
type.
I do the following.
List<stringmyList = new List<string>();
That's not a linked list.
So what can they mean when they say different objects types.

Does it sounds reasonable that they mean a linked-list of object like
this
List<ObjectmyList = new List<Object>();
No. But perhaps they mean this:

LinkedList<objectmyList = new LinkedList<object>();

Pete
Oct 16 '08 #2

P: n/a
Hello!

I just wonder what advantages does a LinkedList<Thave compared to List<T>
?

So is it possible to say in general when to use LinkedList<T>?

//Tony
"Peter Duniho" <Np*********@nnowslpianmk.comskrev i meddelandet
news:op***************@petes-computer.local...
On Thu, 16 Oct 2008 11:53:17 -0700, Tony Johansson
<jo*****************@telia.comwrote:
>What actually does this sentence mean?
Create a linked-list generic class that enables you to create a chain of
different objects types.

Impossible to say for sure without more context.
>When I create a linked-list generic class for example with the string
type.
I do the following.
List<stringmyList = new List<string>();

That's not a linked list.
>So what can they mean when they say different objects types.

Does it sounds reasonable that they mean a linked-list of object like
this
List<ObjectmyList = new List<Object>();

No. But perhaps they mean this:

LinkedList<objectmyList = new LinkedList<object>();

Pete

Oct 16 '08 #3

P: n/a
On Thu, 16 Oct 2008 13:12:27 -0700, Tony Johansson
<jo*****************@telia.comwrote:
I just wonder what advantages does a LinkedList<Thave compared to
List<T>
The primary advantage is that it's much faster (and simpler) to insert
into or remove an element from a LinkedList<Tthan into a List<T>, except
for operations at the very end of the list. Those operations for a
List<Trequire the entire contents of the data structure after the point
of modification to be copied, whereas for a LinkedList<Tthose operations
can always be completed in constant time, just by modifying a fixed number
of pointers.
So is it possible to say in general when to use LinkedList<T>?
LinkedList<Thas more overhead. So I would only use it when I expect to
spend a lot of time modifying the list in ways other than adding or
removing from the very end. Otherwise, List<Tis probably preferable.

Pete
Oct 16 '08 #4

P: n/a
Tony Johansson wrote:
What actually does this sentence mean?
Create a linked-list generic class that enables you to create a chain of
different objects types.
I think they want you to write your own LinkedList<implementation.

Arne
Oct 16 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.