VB.Net Hashtable Primer Tutorial

VB.Net Hashtable Primer Tutorial

VB.Net Hashtable Primer Tutorial

Yesterday we took a look at Hashtable and ArrayList functionality with Java with Java Hashtable Primer Tutorial as shown below. Today we do this again but write the code within the Windows Visual Studio (2010 Express) IDE using VB.Net, using a Hashtable (VB.Net “collection”) data structure, to create a simple Contact List program. Are you familiar with Hashtables? They can simulate, in a lot of ways, what a relational database can do for you to use a VB.Net collection to address that “age old” programming logic “sentence” …


hashtable["key"] = "value"

… do you see how like a database (table design) that statement is? And also how like the way a lot of us think, that is? Also close in thought to this are associative arrays.

The combination of ArrayLists and Hashtables add many possibilities for sorting ideas for our Contact List (VB.Net) program we develop (and compile) today. The population of the ArrayList can sometimes proceed at the same time as the Hashtable, as we do with our code today.

The VB.Net code fits into a Visual Studio (2010 Express) VB.Net Console Application project. We use the InputBox method to handle the interactive input, and the output findings, as well.

Here is some downloadable VB.Net source code you could call Module1.vb and you can get a close up of the tutorial picture.

Hope you get some ideas out of Hashtables and ArrayLists and the combination of the two, in VB.Net, today, with our tutorial. Hashtable and ArrayList concepts also exist in languages like Java and C#. Hope to see you again tomorrow.


Previous relevant Java Hashtable Primer Tutorial is shown below.

Java Hashtable Primer Tutorial

Java Hashtable Primer Tutorial

Some time ago (with Java XCode ArrayList Primer Tutorial as shown below) we used a (Java “collection”) data structure called ArrayList in Java via Xcode on a Mac laptop. Today we do this again (without the Xcode these days), but also use a Hashtable (Java “collection”) data structure, to create a simple Contact List program. Are you familiar with Hashtables? They can simulate, in a lot of ways, what a relational database can do for you to use a Java collection to address that “age old” programming logic “sentence” …


hashtable["key"] = "value"

… do you see how like a database (table design) that statement is? And also how like the way a lot of us think, that is? Also close in thought to this are associative arrays.

The combination of ArrayLists and Hashtables add many possibilities for sorting ideas for our Contact List (Java) program we develop (and compile) today. The population of the ArrayList can sometimes proceed at the same time as the Hashtable, as we (mostly) do with our code today (making use of the interactive (console) Scanner class), but we also populate an ArrayList after the (populating) event for the reverse Enumeration part of the data, and this may interest you … look for …


for (Enumeration e = contactsHT.elements(); e.hasMoreElements();) {
sortingEmail.add(e.nextElement());
}

The compilation instructions are very simple for a Terminal command line session on a Mac laptop (but could equally apply for other platforms too) …

  • javac TestHashtableArraylist.java
  • java TestHashtableArraylist

…. though there is functionality to accept extra command line arguments to specify a name of interest that you want to find the email of during the normal execution of the program.

Here is some downloadable Java source code you could call TestHashtableArraylist.java and you can get a close up of the tutorial picture.

Hope you get some ideas out of Hashtables and ArrayLists and the combination of the two, perhaps, in Java, today, with our tutorial. Hashtable and ArrayList concepts also exist in languages like VB.Net and C#. Hope to see you again soon.


Previous relevant Java XCode ArrayList Primer Tutorial is shown below.

Java XCode ArrayList Primer Tutorial

Java XCode ArrayList Primer Tutorial

Here is a tutorial that uses ArrayList structure in Java via XCode on a Mac laptop.

This program counts the occurrence of characters within the contents of a text file.

We have one input text file which we are going to read.
We use one ArrayList to contain characters of interest to find.
We use another ArrayList to contain character counts collected.

Breaking this down, it would be good to:

a) have method that reads the text file and does the report
b) have method to count occurrences of a character within a String
c) have method to count number of words within a String (and total characters in words)

This way you can report:

. occurrences of a character of interest within a line of the input text file
. total count and percentage of characters of interest within the whole text file
. total count and percentage of other characters within the whole text file
. total count of words within the whole text file
. average word size is ((total characters in words) / (total count of words))

So we’ll build up a FindOccurrences class this way.

Need to have rules about the input text file. Will have it that:

1) there is an optional first header record with number of records of interest
2) all records need {cr} (and/or {lf}) delimitation (as a text file should)

How do we obtain the filename? Will have it that:

(1) it can optionally be passed as a command line parameter
(2) if not we will prompt for it and allow a non-answer meaning it is inputfile.txt

Do we assume a and A (for instance) are the same thing? Will have it that:

(a) assume as a default a and A are to be treated as one entity for searching purposes
(b) there is a, albeit awkward, way to say that a and A are separate, via (2) above

Let’s see some Java programming code for this, and how it works …

Download source code and rename to FindOccurrences.java

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, Software, Tutorials, Visual Studio and tagged , , , , , , , , , , . Bookmark the permalink.

23 Responses to VB.Net Hashtable Primer Tutorial

  1. I like what you guys are up too. Such smart work and reporting! Carry on the superb works guys I have incorporated you guys to my blogroll. I think it’ll improve the value of my web site :)

  2. Daniel says:

    Witaj, wyjฤ…tkowy artykuล‚. Dawno nie sล‚uchaล‚em tak interesujฤ…cego pisarstwa.

  3. Laura says:

    Siema, super artykuล‚. Okreล›lony czas nie pisaล‚em tak interesujฤ…cego tekstu

  4. You’ve got noted extremely fascinating points ! ps good site .

  5. Iโ€™m not sure where you’re getting your info, but good topic. I needs to spend some time learning much more or understanding more. Thanks for magnificent info I was looking for this info for my mission.

  6. Sales says:

    Good site! I truly love how it is easy on my eyes and the data are well written. I’m wondering how I could be notified when a new post has been made. I’ve subscribed to your RSS which must do the trick! Have a great day!

  7. Hey! Good stuff, do tell us when you finally post something like this!

  8. intelligent says:

    What i don’t understood is in reality how you are no longer actually a lot more well-liked than you might be now. You are so intelligent. You recognize thus considerably in terms of this subject, made me personally consider it from so many varied angles. Its like women and men don’t seem to be involved unless it’s something to accomplish with Woman gaga! Your individual stuffs outstanding. At all times care for it up!

  9. krk says:

    Over and over again I take into consideration these problem. As a matter of fact it was not even yesterday that I last thought about it. To be honest, what is your thought though?

  10. I was suggested this website by my cousin. Iรขโ‚ฌโ„ขm not certain whether this post is written by him as no one else know such detailed about my trouble. You are amazing! Thanks! xrumer

  11. Extremely great post, thanks a great deal for sharing. Do you happen to have an RSS feed I can subscribe to?

  12. Finance says:

    you’re really a excellent webmaster. The web site loading pace is amazing. It seems that you are doing any distinctive trick. In addition, The contents are masterpiece. you have done a fantastic activity in this subject!

  13. gastric sleeve surgery diet says:

    Most I can say is, Iโ€™m not sure what to express! Except needless to say, for the wonderful ideas that are shared on this weblog. I am able to think of a zillion fun techniques to read the articles or blog posts on this web-site. Thereโ€™s no doubt that I’ll eventually take a step along with your ideas on that matter I could not happen to be in a position to touch alone. You were so innovative to permit me to be 1 of those to benefit from your valuable information and facts. Please see how considerably I appreciate it.

  14. I will invite all my good friends for your website, you seriously got a great weblog.*:-`

  15. I carry on listening to the newscast speak about getting free online grant applications so I have been looking around for the best site to get one. Could you advise me please, where could i get some?

  16. Rest says:

    Hello, you used to write excellent, but the last few posts have been kinda boringยกK I miss your super writings. Past several posts are just a little out of track! come on!

  17. dig says:

    We’re a group of volunteers and starting a new scheme in our community. Your website offered us with valuable information to work on. You have done an impressive job and our entire community will be grateful to you.

  18. Alert says:

    Is not it excellent after you acquire a superb submit? So content to get found this publish.. Loving the posting.. all the best My personal web surfing seem complete.. thanks.

  19. laugh says:

    Adoring the blog post.. thank you so much My internet browsings seem full.. thanks. Undoubtedly handy mindset, many thanks for sharing with us.. Unquestionably helpful point of view, thanks for sharing with us..

  20. kijiji phone says:

    Fabulous, what a website it is! This weblog presents valuable data to us, keep it up.|

  21. Had to compose you a quite little word to say thanks to you yet again concerning the nice suggestions you’ve led here.

Leave a Reply to pusatrentcar.com Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>