473,385 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Collection Object

I am using Listdictionary to store key value pair as this doen't sort the key
on it's own. i want the Key value to appear in same sequence as i entered
while retreiving. i can't use the listdictionary as the items i am storing
goes above 10 and which is not recommended for the large collection. i can't
use Hashtable as it sort the collection on the hash code of the key.

i there any collection object which i can use that will give result back the
way i entered in it?
Sep 11 '05 #1
2 1719


Swap wrote:
I am using Listdictionary to store key value pair as this doen't sort the key
on it's own. i want the Key value to appear in same sequence as i entered
while retreiving. i can't use the listdictionary as the items i am storing
goes above 10 and which is not recommended for the large collection. i can't
use Hashtable as it sort the collection on the hash code of the key.
Such a collection is called a linked hashtable. JAVA have such a
data-tructure called java.util.LinkedHashMap.
i there any collection object which i can use that will give result back the
way i entered in it?


Not in System.Collections. You can easily implement one though. If you
never remove items from you dictionary, you can simply maitain a
separate IList of keys which you add to when items are added to your
dictionary.

If you also need to remove items, you can map keys, not into the
user-passed value, but to a double-linked data-structure, like:

class Value {
public Value Next;
public Value Previous;
public Object UserValue;
}

and maintain the links when inserting and removing items.

--
Helge Jensen
mailto:he**********@slog.dk
sip:he**********@slog.dk
-=> Sebastian cover-music: http://ungdomshus.nu <=-
Sep 11 '05 #2
Swap wrote:
I am using Listdictionary to store key value pair as this doen't sort the key
on it's own. i want the Key value to appear in same sequence as i entered
while retreiving. i can't use the listdictionary as the items i am storing
goes above 10 and which is not recommended for the large collection. i can't
use Hashtable as it sort the collection on the hash code of the key.

i there any collection object which i can use that will give result back the
way i entered in it?


Sure. An ArrayList. Or a List<T>.

--

www.midnightbeach.com
Sep 11 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Generic Usenet Account | last post by:
To settle the dispute regarding what happens when an "erase" method is invoked on an STL container (i.e. whether the element is merely removed from the container or whether it also gets deleted in...
5
by: Kurt Bauer | last post by:
I have an ASP group calendar application which pulls calendar data from Exchange via webdav into an XML string. I then loop the XML nodes to populate a collection of appointments. Finally I use...
5
by: Kurt Bauer | last post by:
I have an ASP group calendar application which pulls calendar data from Exchange via webdav into an XML string. I then loop the XML nodes to populate a collection of appointments. Finally I use...
10
by: Chet Cromer | last post by:
I am creating a set of base classes and sub classes to use throughout a program I'm developing. The base class represents a generic "lookup table" from my database that contains lists of things...
9
by: bonk | last post by:
Does anyone have a simple example on how to prohibit that any thread other than the current thread modifies a certain object (a collection) while we are in a certain section of the code? In other...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.