WebDriver Java Tutorials : Hashtable

As nosotros accept learnt In my previous post, Using ArrayList inward coffee software evolution Is really practiced choice of array when you lot don't know how many values you lot accept to shop In array because ArrayList Is automatic dynamic growing array past times Index. One to a greater extent than matter nosotros needs to purpose In selenium webdriver software automation show instance Is Hashtable inward java. We volition larn only basic matter virtually Hashtable to purpose It In our selenium WebDriver Test instance evolution for software spider web application.

What Is Hashtable?
Hashtable Is a shape In java software evolution linguistic communication as well as provides us a construction to shop primal as well as its value equally a duet In tabular array format. Means nosotros tin dismiss shop value alongside Its primal as well as tin dismiss access that value using Its key. There Is non whatever Index of value In Hashtable. Key's Hashcode volition endure used to map the value alongside primal In Heshtable. Let me exhibit you lot really elementary representative of Hashtable In java software evolution language.

//Import Hashtable header file. import java.util.Hashtable;  world shape Hash {  world static void main(String[] args) {   //Created hashtable shape object to purpose Its dissimilar properties.   Hashtable<String, Integer> t1 = novel Hashtable<String, Integer>();   t1.put("Legs", 4); //Store value four In primal = Legs   t1.put("Eyes",2); //Store value two In primal = Eyes   t1.put("Mouth",1); //Store value i In primal = Mouth      //Accessing hash tabular array values using keys.   System.out.println("Animal Legs = " +t1.get("Legs"));   System.out.println("Animal Eyes = " +t1.get("Eyes"));   System.out.println("Animal Mouth = " +t1.get("Mouth"));  } }

Need More Tutorials On Java And Selenium WebDriver? VISIT THIS PAGE

As you lot come across In higher upwardly example, I accept created object of Java Hashtable shape as well as hence shop values alongside Its unique keys. Then I accept used keys to access as well as impress Its values. This agency nosotros tin dismiss shop as well as access values from hash tabular array whenever required In java software evolution language.

More interesting articles here :Generation Enggelmundus Internet Marketing Tool here :Zeageat IM

http://www.software-testing-tutorials-automation.com/
Post a Comment (0)
Previous Post Next Post