tags:

views:

182

answers:

4

What are some of the different ways a developer can create his own List objects?

+2  A: 

AbstractList is a good starting point

dfa
It's abstract, so you can't create any objects using it without creating concrete classes first
Pete Kirkham
I've interpreted the question as "creating custom list classes"
dfa
The question asked for List object.
Steve Kuo
+1  A: 

Crete some object and add property of type array in it. Then you need to implement methods for accessing list items.

coffy
Otherwise known as the Minoan approach
Pete Kirkham
Actually, it reminded me there is no need to make items accessible by sequence order. I would go for approach to create ListItem class with next() and previous() methods and then use them in List class.What is a name for this approach? :)
coffy
+14  A: 

I usually get a piece of paper and write things down. I use a dot or dash in front. Like this:

  • milk
  • eggs
  • ice cream
  • butter
  • oranges
  • cereal

and that takes care of the shopping list.

If I make a list for the weekend it is the same piece of paper and looks like:

  • mow lawn
  • wash car
  • walk dog
  • clean basement
  • fix leak in car tire

I generally cross things off as they are done. Sometimes I reorder the items and prioritize. Usually I end up with lots of half-finished lists and then it all becomes a mess. I sometimes just copy them over to a new/clean sheet and throw the old one in the trash.

Tim
Oddly, that does seem to answer the question. I can't bring myself to upvote it, though.
Michael Myers
This is the BEST answer on stackoverflow since a really looong time!!! GREAT! +1
ivan_ivanovich_ivanoff
Why can I only upvote this once?
Hardwareguy
Just playing devils advocate here, but how much does this answer add to the value of SO ? If someone Googled this Question and got referred to this, they'd think they arrived in the land of Trolls.
_ande_turner_
If someone googled this question, they most likely belong in the land of trolls
oxbow_lakes
It's still troll-ville when the community randomly decides not to answer a programming related question... on a website devoted to answering programming related questions. The question has a score of -4 right now. All these downvoters are trolls. At least this answer is funny.
Kieveli
I upvoted the question. I answered it with this bit in response to the only comments at the time that were very negative - regarding homework, etc. rather than attack anyone or give an answer to a vague question i thought I would at least inject a little good natured humor. This site has so little of that. I meant no disrespect or ill will.
Tim
Note also that there is a discussion in my answer about garbage collection and sorting. (things you can do with lists)
Tim
+2  A: 

There's already a really good explanation of how to implement a linked list in Java on this SO thread.

Many other implementations will be similar, but some, like ArrayList, use an array internally to hold references to list elements. You'll very likely want to implement the List interface, or extend a class like AbstractList that already implements List.

Bill the Lizard