hashtable

sql vs hashtable.containskey vs string.contains

I have a list of values extracted from a sql query in order to find out if x provided values are present in it. SQL: -Select null from table where code='x' -resul.count>0 String: -Loop for concatenating the codes in one string -codesstring.Contains("x") Hashtable: -Loop for adding the codes to the hashtable -codeshashtabl...

C++ hash table w/o using STL

I need to create a hash table that has a key as a string, and value as an int. I cannot use STL containers on my target. Is there a suitable hash table class for this purpose? ...

xmlEncoder not writing in netBeans

Hi, I am trying to use the xmlEncoder to write to xml file in net-beans but it doesnt work. Here is the call to the writing function: dbManipulator.writeStudents(deps); where deps = new Hashtable<String, Department>(); dbManipulator = new DataBaseManipulator(); Department is an class-object I made, and here is writeStudents metho...

Why is my Map broken?

Scenario: Creating a server which has Room objects which contain User objects. I want to store the rooms in a Map of some sort by Id (a string). Desired Behavior: When a user makes a request via the server, I should be able to look up the Room by id from the library and then add the user to the room, if that's what the request needs. ...

problem adding object to hashtable

I am trying to call a class method dynamically depending on a condition. This is how I am doing it I have three classes implement a single interface interface IReadFile { string DoStuff(); } The three classes A,B,C implement the interface above. I am trying to add them to a hashtable with the code below _HashT.Add("a"...

J2ME Vector of Hashtable query

I am a newbe to J2ME. I have a vector called locations which prints out [{X=NM0001-1, ccc=1327_10}, {X=NM0001-2, ccc=1329_10}, {X=NM0001-3, ccc=691_10}] when I put System.out.println(locations); I set "X", and "ccc" are the keys. In my program I wanted to query for certain value of "ccc" what is the "X" value. Any help would be ...

Python: What's a correct and good way to implement __hash__()?

What's a correct and good way to implement __hash__()? I am talking about the function that returns a hashcode that is then used to insert objects into hashtables aka dictionaries. As __hash__() returns an integer and is used for "binning" objects into hashtables I assume that the values of the returned integer should be uniformly dist...

how to get HashTable values as Arraylist ?

Hi all, I have: Hashtable <String, Word> hw How can I convert its values to: ArrayList <Word> arr thanks. ...

hashtable implementation in C?

Hello, I was wondering if you knew of a robust implementation of a hashtable in C. I'm looking for something other than ghashtable in glib. Thanks. ...

C#: Storing Instance of Objects in (Hashtable)

Hi I tried filling a Hashtable in the following way: ResearchCourse resCourse= new ResearchCourse();//Class Instance resCourse.CID="RC1000"; resCourse.CName="Rocket Science"; TaughtCourse tauCourse= new TaughtCourse();//Class Instance tauCourse.CID="TC1000"; tauCourse.CName="Marketing"; Hashta...

Constructing a hash table/hash function.

Hi, I would like to construct a hash table that looks up keys in sequences (strings) of bytes ranging from 1 to 15 bytes. I would like to store an integer value, so I imagine an array for hashing would suffice. I'm having difficulty conceptualizing how to construct a hash function such that given the key would give an index into the ar...

How to Bind CheckBoxlist with HashTable

Hi Everybody, I want to bind checkboxlist to Hashtable . what shoud i put in datatextfield and datavaluefield. Thanks in advance. ...

how to bind dataset data to the hashtable in asp.net

I want to bind dataset data to hashtable in asp.net with c#. data set has two fields id and amenities. How to do that. Thanks in advance. ...

Hash table vs Hash list vs Hash tree?

What property makes Hash table, Hash list and Hash tree different from each other? Which one is used when? When is table superior than tree. ...

replace values in a String from a Hashtable in Java

My string looks like; String values = "I am from UK, and you are from FR"; and my hashtable; Hashtable countries = new Hashtable(); countries.put("United Kingdom", new String("UK")); countries.put("France", new String("FR")); What would be the most effective way to change the values in my string with the values from the hashtable a...

How to fix the size of the Hashtable and find the whether it has fix size or not?

Hi All, I am trying to fix the size of the Hashtable with following code. Hashtable hashtable = new Hashtable(2); //Add elements in the Hashtable hashtable.Add("A", "Vijendra"); hashtable.Add("B", "Singh"); hashtable.Add("C", "Shakya"); hashtable.Add("D", "Delhi"); hashtable.Add("E...

are deleted entries counted in the load factor of a hash table using open addressing

When calculating the load factor of a hashtable with an open-addressing array implementation I am using: numberOfKeysInArray/sizeOfArray however it occurred to me that since deleted entries must be marked as such (to distinguish them from empty spaces), it might make sense to include these in the number of keys. My thinking is that ...

C#: How to bind HashTable to a ComboBox via Enum as a key?

public static Hashtable m_results = new Hashtable(); private BindingSource m_bindResults = new BindingSource(); // in static constructor m_results.Add(MyResultTypes.Failed, "Failed"); m_results.Add(MyResultTypes.Pending, "Is Pending"); m_results.Add(MyResultTypes.Completed, "Was Completed"); m_results.Add(MyResultTypes.Cancel, "Cancel i...

C# Dictionary<> and mutable keys

I was told that one of the many reasons strings were made immutable in the C# spec was to avoid the issue of HashTables having keys changed when references to the string keys altered their content. The Dictionary<> type allows reference types to be used as a key. How does the dictionary avoid the issue of altered keys that lead to "mis...

Get a value from hashtable by a part of its key

Hi. Say I have a Hashtable<String, Object> with such keys and values: apple => 1 orange => 2 mossberg => 3 I can use the standard get method to get 1 by "apple", but what I want is getting the same value (or a list of values) by a part of the key, for example "ppl". Of course it may yield several results, in this case I want to be a...