Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Collection Types

Status
Not open for further replies.

ehx6

IS-IT--Management
Joined
May 20, 2004
Messages
150
Location
US
hi,
I am reading about collection and have a question about it.
I realize that there are a lot of collection classess:
ArrayList, SortedList.....etc
what difference b/w them and how would I know which one to use.
thanks
Ehx
 
In some of them, order is important:
ArrayList, SortedList, Stack, Queue

In others, order is not important:
HashTable

You can ignore any collection classes that start with "I", or have the word "Base" in them. Those are used to create the other collection types.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Chip, thanks for your input, can I use a collection to add information such as table fields. it would look like this
my collection:
---------------
id |name | age| country

basically, I am creating a complete row in a collection, then I can pass this collection to specific method to process it. Is that doable. or is there a better way to do that.
thanks
Ehx
 
You can do that. Everything gets converted to type Object, so the recipient would need to know that item 5 in the collection is a boolean, and item 6 is a string.

As you might imagine, this is not the best way to pass variables to a method. If you have more than 10 or so parameters, it's best to create another class to contain them all (this is called a messenger class). The advantage is you keep strong typing, and you can also access the members of the class via the dot operator.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Thanks chip, I am new to OOP development and I appreciate if you advice me of a good book to start reading about how to become pro in oop programming.
thanks
Ehx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top