Showing posts with label selenium tutorial. Show all posts
Showing posts with label selenium tutorial. Show all posts

Friday, August 31, 2018

Selenium Tutorial

Selenium Tutorial

Selenium tutorial for beginner is basic requirement of whatever selenium learner to acquire selenium perfectly if it's gratuitous too complete. Selenium is really rigid too open-source spider web application automation testing tool too therefore selenium testing tool is booming right away a days inward software testing industry.

Selenium has dissimilar projects similar selenium IDE, selenium RC, selenium Webdriver, Appium too selenium Grid. Please banknote here, I am maxim them dissimilar projects of selenium non a versions because each selenium projection has it's ain features too developed for dissimilar purpose.

is basic requirement of whatever selenium learner to acquire selenium perfectly if it Selenium Tutorial

I possess got created tutorial serial for dissimilar selenium projects amongst examples to back upwardly online selenium learner community. My selenium tutorial for beginners amongst examples volition helps you lot to acquire selenium testing really fast. All bellow given selenium project's tutorials volition accept you lot from basic to advanced degree footstep yesteryear footstep too you lot volition hold upwardly primary at the destination of series. Trust Me !! Selenium RC is officially deprecated right away too therefore i possess got non created tutorial serial for RC. Just start amongst selenium IDE tutorial serial too destination on selenium grid tutorial series.

Selenium Tutorial

Bellow is selenium coffee tutorial serial of dissimilar selenium projects.

1. Selenium IDE tutorial

Selenium IDE is commencement projection of selenium. It is basic tape too playback improver of firefox browser. You tin work selenium IDE if your application is non to a greater extent than complex to test. My Selenium IDE tutorial serial volition helps you lot to acquire selenium IDE.

2. Selenium WebDriver tutorial

Selenium Webdriver is latest projection of selenium which is interface too designed to automate spider web applications. It is designed to overcome limitations of selenium RC(which is deprecated now.) too therefore it is successor of selenium RC. I possess got created online selenium interview questions amongst 110+ interview questions. It volition helps you lot to confront selenium testing tool interview.

3. Appium tutorial

Appium is mobile native, spider web too hybrid application essay automation testing framework. You tin automate ios too android apps using appium. Appium Tutorial serial is created to depict how appium plant amongst examples.

4. Selenium Grid tutorial

Selenium grid helps you lot to run your selenium automation tests inward parallel on dissimilar machines too browsers to speedup your essay execution. So you lot tin run your tests on dissimilar machines which are running dissimilar browsers on dissimilar operating systems. Selenium Grid Tutorial serial which is created to exhibit you lot how genuinely grid tin helps you lot to speed-up your essay execution process.

All to a higher house selenium tutorial serial are created amongst practical examples too detailed description on each topic. Start selenium learning today to seat your footstep inward selenium automation testing manufacture too also portion your novel ideas amongst others.

5. Selenium Video Tutorial

Also you lot tin subscribe for selenium video tutorial if you lot tin pay about bucks for learning. As per my view, investment inward education/learning is best investment.

Thursday, February 25, 2016

Vector Cast Inwards Java

Vector Cast Inwards Java

  • Vector cast inwards coffee implements List interface of collection framework.
  • Vector cast is synchronized.
  • If you lot don't know size of array therefore you lot tin piece of employment vector cast every bit size of vector tin grow together with shrink every bit per adding together with removing items.
  • As vector cast is synchronized, It volition rank pitiable performance on add, delete, update together with search operations.
  • Elements of vector tin live accessed using it's integer index.
Vector cast inwards coffee implements List interface of collection framework Vector Class In Java

Important method of vector class
  • void addElement(Object element) : It volition add together specified chemical component at destination of vector.
  • int capacity() : It volition supply the electrical flow capacity of vector.
  • int size() : This method volition supply electrical flow size of vector.
  • void setSize(int size) : It volition gear upwards size of vector using given size value.
  • boolean contains(Object element) : It volition supply truthful if specified chemical component acquaint inwards vector. Else it volition supply false.
  • boolean containsAll(Collection c) : It volition supply truthful if vector contains all values of given collection c.
  • Object elementAt(int index) : It volition supply chemical component which is located at specified index of vector.
  • Object firstElement() : It volition supply get-go chemical component of vector.
  • Object lastElement() : It volition supply concluding chemical component of vector.
  • Object get(int index) : It volition supply chemical component located at the specified index of vector.
  • boolean isEmpty() : It volition supply truthful if vector is empty.
  • boolean removeElement(Object element) : It volition take given chemical component from vector.
  • boolean removeAll(Collection c) : It volition take all elements of collection c from vector.
  • void setElementAt(Object element, int index) : It volition gear upwards specified chemical component at given index of vector.
Bellow given sample plan volition demo you lot how to piece of employment vector cast together with it's unlike methods.

Vector cast example
package JAVAExamples;  import java.util.Enumeration; import java.util.Vector;  populace cast VectorExample {  populace static void main(String args[]) {   //Initial vector capacity is 2. Increment it past times 2 when required.   Vector 5 = novel Vector(2,2);   System.out.println("Initial capacity of vector : "+v.capacity());   v.addElement("one");   v.addElement("two");   v.addElement("three");     System.out.println("Capacity of vector subsequently adding 3 elements inwards vector : "+v.capacity());    //Get size of vector.   System.out.println("Size of vector : "+v.size());    //Get get-go chemical component of vector.   System.out.println("First chemical component of vector : "+v.firstElement());      //Get concluding chemical component of vector.   System.out.println("Last chemical component of vector : "+v.lastElement());      //Add novel chemical component inwards vector.   v.add(2, "New Element");      //Print all elements of vector using Enumeration.   Enumeration vEnum = v.elements();   System.out.print("Current vector elements : ");   while(vEnum.hasMoreElements()){    System.out.print(vEnum.nextElement() + ", ");   }      System.out.println();      //Check if vector is empty.   System.out.println("Vector is empty? : "+v.isEmpty());    } }

Output :
Initial capacity of vector : 2 Capacity of vector subsequently adding 3 elements inwards vector : four Size of vector : 3 First chemical component of vector : 1 Last chemical component of vector : 3 Current vector elements : one, two, New Element, three,  Vector is empty? : false

Above instance shows you lot usage of by together with large used methods of vector class. http://www.feedbooks.com/user/4455042/profile
Stack Degree Inwards Coffee Example

Stack Degree Inwards Coffee Example

  • Stack bird inward coffee is i of the collection interface bird which is subclass of Vector class.
  • Stake bird supports park force together with popular operations.
  • In contrast to queue, Stack bird has last-in first-out(LIFO) information structure. So detail which is inserted at hap volition live available first.
  • Stack bird extends Vector bird of List interface therefore it includes all methods of vector bird together with likewise it has it's ain several methods to perform force together with popular operations similar looking hap detail from stack, removing hap detail from stack, force novel detail at hap of stack, searching detail from stack together with cheque whether stack is empty.
Stack bird inward coffee is i of the collection interface bird which is subclass of Vector c Stack Class inward Java Example



Important Methods of Stack Class inward Java


  • boolean empty() : This method of stack bird volition manage y'all to cheque if stack is empty.
  • Object peek( ) : It volition expect together with provide hap chemical subdivision of stack. It volition non take away chemical subdivision from stack.
  • Object pop( ) : It volition take away detail from hap of the stack together with provide the value.
  • Object push(E item) : It volition force an detail on hap of the stack
  • int search(Object o) : It volition lift one's heed if object is be inward stack. If be together with then it volition provide item's index. Top detail of stack has index = 1.
Below given practical instance of coffee stack bird volition present y'all how to a higher house methods work.

package JAVAExamples;  import java.util.Stack;  world bird JavaStackExample {  world static void main(String args[]) {   //Create stc stack.   Stack stc = novel Stack();   //Initially stack volition live empty.   System.out.println("Stack is empty? : "+stc.empty());   //Push items inward stack.   stc.push("Item1");   stc.push("Item2");   stc.push("Item3");   //Now stack if filled.   System.out.println("Now stack empty? : "+stc.empty());   //Print stack items.   System.out.println("stack Ietms : " + stc);   //Get hap detail from stack.   System.out.println("Top detail inward stack is : "+stc.peek());   //Print stack items afterwards peek.   System.out.println("stack Ietms afterwards peek : " + stc);   //Get together with take away hap detail from stack.   System.out.println("Get hap detail from stack together with removed it from stack : "+stc.pop());   //Print stack items afterwards pop.   System.out.println("stack Ietms afterwards popular : " + stc);   //Push novel detail inward stack.   stc.push("Item4");   //Print stack afterwards inserting novel item.   System.out.println("Now stack Ietms are : " + stc);   //Search detail from stack which is available.   System.out.println("Search Item1 inward stack is at index : "+stc.search("Item1"));   //Search detail from stack which is non available inward stack.   System.out.println("Search Item7 inward stack which is non available is : "+stc.search("Item7"));  } }


Output :
Stack is empty? : truthful Now stack empty? : faux stack Ietms : [Item1, Item2, Item3] Top detail inward stack is : Item3 stack Ietms afterwards peek : [Item1, Item2, Item3] Get hap detail from stack together with removed it from stack : Item3 stack Ietms afterwards popular : [Item1, Item2] Now stack Ietms are : [Item1, Item2, Item4] Search Item1 inward stack is at index : iii Search Item7 inward stack which is non available is : -1

Now i intend y'all volition empathize how together with when to role stack bird inward java.
Java Queue Interface

Java Queue Interface

  • If you lot hold back at collection hierarchy, Queue extends collection interface.
  • Main operate of collection is to concur the elements prior to processing.
  • Queue interface provides to a greater extent than or less additional operations similar insertion, inspection too extraction too collection interface operations.
  • All these 3 operations be inwards 2 dissimilar forms. One render exceptional value(null or faux depending on the operation) if functioning fails else throws an exception if functioning fails.
  • Queue follows FIFO(first-in-first-out) too then it volition insert chemical component subdivision at the terminate of the queue when you lot insert novel chemical component subdivision too chemical component subdivision volition endure removed from the kickoff of the queue when you lot withdraw element.
  • As Queue interface is sub type of collection interface, all methods of collection interface are also available in Queue interface.
Main operate of collection is to concur the elements prior to processing Java Queue Interface


 Basic methods of Queue interface
Few of the basic Queue interface methods are every bit below.
  • boolean add(E e) : It volition insert an chemical component subdivision inwards queue if infinite is available inwards queue. Else it volition render IllegalStateException.
  • E element() : It volition render head(first element) of queue if queue inwards non empty. It volition render NoSuchElementException exception if Queue is empty.
  • boolean offer(E e) : It volition insert chemical component subdivision inwards queue if infinite is available inwards queue.
  • E peek() : It volition render head(first element) of queue if queue inwards non empty. Else it volition render null.
  • E poll() : It volition think too withdraw head(first element) of the element. Return cipher if queue is empty.
  • E remove() : It volition think too withdraw head(first element) of the element. It volition render NoSuchElementException exception if Queue is empty.
I accept prepared instance on basic Queue interface methods to present demo how they works.

Queue Interface Example
package JAVAExamples;  import java.util.LinkedList; import java.util.Queue;  world course of teaching QueueExample {   world static void main(String[] args) {   //Creating queue.   Queue q = novel LinkedList();      //Inserting elements inwards queue.   q.add("three");   q.add("two");   q.add("one");     q.add("four");   q.add("six");   q.add("seven");   q.add("five");      //Print queue elements.   System.out.println("Queue elements are : "+q);      //Removing firstly inserted chemical component subdivision from queue using withdraw method.   q.remove();   System.out.println("Queue elements afterward chemical component subdivision removal using withdraw method : "+q);      //retrieve caput of queue (first element) using chemical component subdivision method.   System.out.println("Now firstly chemical component subdivision inwards queue is : "+q.element());      //Insert chemical component subdivision inwards queue using offering method.    q.offer("eight");   System.out.println("Queue elements afterward inserting chemical component subdivision using offering method : "+q);      //Removing specific chemical component subdivision from queue.   q.remove("six");   System.out.println("Queue elements afterward removing half dozen chemical component subdivision : "+q);    //Removing caput of queue (first element) using poll method.   q.poll();   System.out.println("Queue elements afterward removing chemical component subdivision using poll method : "+q);      //retrieve caput of queue (first element) using peek method.   System.out.println("Now firstly chemical component subdivision inwards queue is : "+q.peek());    } }

Output :
Queue elements are : [three, two, one, four, six, seven, five] Queue elements afterward chemical component subdivision removal using withdraw method : [two, one, four, six, seven, five] Now firstly chemical component subdivision inwards queue is : 2 Queue elements afterward inserting chemical component subdivision using offering method : [two, one, four, six, seven, five, eight] Queue elements afterward removing half dozen chemical component subdivision : [two, one, four, seven, five, eight] Queue elements afterward removing chemical component subdivision using poll method : [one, four, seven, five, eight] Now firstly chemical component subdivision inwards queue is : one

Java Gear Upward Interface As Well As Methods

Java Gear Upward Interface As Well As Methods

  • Set is 1 of the collection framework interface which extends origin Collections interface.
  • Set collection tin non comprise duplicate elements.
  • Set interface has all methods which are inherited from Collection interface amongst special restriction of non allowing duplicate elements.
  • If 2 Set interface contains same elements together with then both are equal.
  • Set interface is implemented past times LinkedHashSet, HashSet classes together with extended past times SortedSet interface which is implemented past times TreeSet.
Set is 1 of the collection framework interface which extends origin Collections interface Java Set Interface And Methods
Important Methods of Set Interface
  • boolean add(E e) : It volition insert specified chemical cistron inwards laid if it is non available inwards set.
  • boolean addAll(Collection<? extends E> c) : It volition add together all elements of specified collection inwards laid if non already acquaint inwards set.
  • void clear() : It volition take away all elements from set.
  • boolean contains(Object o) : It volition provide truthful if  given chemical cistron is available inwards set.
  • boolean containsAll(Collection<?> c) : It volition provide truthful if all the elements of given collection are available inwards set.
  • boolean equals(Object o) :It volition compare specified object amongst laid to banking concern jibe equality.
  • boolean isEmpty() : It volition provide truthful if laid is empty.
  • int hashCode() :It volition returns hash code value for this set.
  • Iterator<E> iterator() : It volition provide an iterator over the elements inwards set.
  • boolean remove(Object o) : It volition take away specified chemical cistron from the laid if it is present.
  • boolean removeAll(Collection<?> c) : It volition take away all those elements from laid which are specified inwards collection.
  • int size() : It volition provide size of Set.
Below given Set interface event volition demo y'all demo of Set interface's few of import methods.

Java Set Interface Example
package JAVAExamples;  import java.util.HashSet; import java.util.Iterator; import java.util.Set;  world cast SetInterfaceExample {  world static void main(String args[]) {   Set s1 = novel HashSet();   // Check initial size of set.   System.out.println("Initial size of laid : " + s1.size());   // Add items inwards set. Try to add together duplicate exceptional inwards laid every bit laid tin non convey duplicate items.   s1.add("Item1");   s1.add("Item2");   s1.add("Item1");   s1.add("Item3");   s1.add("Item4");   // Print set. It volition demo solely iv items every bit laid tin non concur duplicate items.   System.out.println("Set items are : " + s1);   // Check if laid is empty. It volition provide false.   System.out.println("Set is empty? : " + s1.isEmpty());    // access laid items through Iterator.   Iterator iterator = s1.iterator();                 System.out.println("Set items are : ");   piece (iterator.hasNext()) {    String chemical cistron = (String) iterator.next();    System.out.println(element);   }    // Remove exceptional from set.   s1.remove("Item3");   // Set items afterwards removing Item3 from set.   System.out.println("Now Set items are : " + s1);   // Get laid size.   System.out.println("Set size is : " + s1.size());  } }

Output :
Initial size of laid : 0 Set items are : [Item1, Item2, Item3, Item4] Set is empty? : imitation Set items are :  Item1 Item2 Item3 Item4 Now Set items are : [Item1, Item2, Item4] Set size is : 3

This way, You tin role coffee laid to shop non duplicate items.

Wednesday, February 24, 2016

Java Linkedhashset Class

Java Linkedhashset Class

  • LinkedHashSet Class extends extends HashSet shape together with Implements Set interface inward collection interface hierarchy.
  • LinkedHashSet implementation differs from HashSet every bit it maintains doubly-linked listing running through all of its entries.
  • It maintains element's entries inward laid upwards every bit per it's insertion order. So it volition permit y'all insertion companionship iteration over the set. So when y'all iterate over LinkedHashSet, In which companionship it volition provide elements? Answer is As per it's insertion order.
  • So y'all volition function out same re-create of elements amongst the companionship how they inserted inward set. 
  • LinkedHashSetis non synchronized.
extends HashSet shape together with Implements Set interface inward collection interface hierarchy Java LinkedHashSet Class



Bellow given example volition demonstrate y'all basic methods of  LinkedHashSet together with it's usage.

package JAVAExamples;  import java.util.Iterator; import java.util.LinkedHashSet;  populace shape LinkedHashSetExample {   populace static void main(String[] args) {   LinkedHashSet<String> lhs = novel LinkedHashSet<String>();   // Add items to LinkedHashSet   lhs.add("one");   lhs.add("two");   lhs.add("three");   lhs.add("four");   // Print LinkedHashSet.   System.out.println(lhs);   // Get size of LinkedHashSet.   System.out.println("LinkedHashSet size Is : " + lhs.size());   // Check if LinkedHashSet is empty?   System.out.println("Is LinkedHashSet emplty? : " + lhs.isEmpty());   // Iterate through LinkedHashSet.   Iterator<String> itr = lhs.iterator();   System.out.println("LinkedHashSet Items are : ");   acre (itr.hasNext()) {    System.out.println(itr.next());   }   // Remove special from LinkedHashSet.   lhs.remove("three");   // Print LinkedHashSet.   System.out.println("Now LinkedHashSet items are : " + lhs);  } }

Output :
[one, two, three, four] LinkedHashSet size Is : 4 Is LinkedHashSet emplty? : fake LinkedHashSet Items are :  i 2 3 4 Now LinkedHashSet items are : [one, two, four]

Hashset Inwards Coffee Collection Example

Hashset Inwards Coffee Collection Example

  • HashSet is a cast of collection framework which extends AbstractSet cast in addition to implements the Set interface.
  • HasSet doesn't guarantee that elements guild volition stay same over the fourth dimension in addition to returned inwards whatever random order.
  • HasSet doesn't permit duplicate values. If you lot endeavour to insert duplicate, It volition overwrite.
  • HasSet allows to shop nothing values.
  • HasSet implementation is non synchronized.
HashSet is a cast of collection framework which extends AbstractSet cast in addition to implements  HashSet inwards Java Collection Example

Important Methods of HashSet
  • boolean add(E e) : To add together elements inwards to laid if it is non already present.
  • void clear() : Remove all entries from set.
  • Object clone() : It volition returns shallow re-create of HasSet instance.
  • boolean contains(Object o) : It volition provide truthful if given values is introduce inwards HashSet.
  • boolean isEmpty() : It volition provide truthful if HasSet is empty.
  • Iterator<E> iterator() : It volition returns an iterator over the elements inwards Set.
  • boolean remove(Object o) : It volition take specified elements from laid if it is available inwards HashSet.
  • int size() : It volition provide size of HashSet.
Bellow given illustration volition demo you lot utilise of unlike HashSet methods.
Example Of HashSet inwards Java
package JAVAExamples;  import java.util.HashSet;  populace cast HashSetJavaExample {  populace static void main(String args[]) {  HashSet hset = novel HashSet();  //Check if HashSet is empty.  System.out.println("HashSet is empty? : "+hset.isEmpty());  //Add elements inwards HashSet.  hset.add("One");  hset.add("Two");  hset.add("Three");  hset.add(null); //HassSet allows nothing values.  hset.add("Four");  //Print HashSet.  System.out.println("HashSet elements are : "+hset);  //Check HashSet size.  System.out.println("Size of HashSet is : "+hset.size());  //Removing chemical cistron from HashSet.  hset.remove("Two");  System.out.println("Now HashSet elements are : "+hset);  } }

Output :
HashSet is empty? : truthful HashSet elements are : [null, One, Four, Two, Three] Size of HashSet is : five Now HashSet elements are : [null, One, Four, Three]

This way, You tin post away role HashSet to shop values inwards random guild including null.

Sunday, February 21, 2016

Java Sortedset Interface

Java Sortedset Interface

  • SortedSet interface extends Set interface inwards collection framework of java.
  • As parent suggest, It provides full ordering on elements of Set.
  • Set elements volition live ordered using their natural ordering or using a comparator interface.
  • All the elements entries of SortedSet must implement Comparable interface.
  • All the elements of SortedSet must live comparable. So e1.compareTo(e2) must non throw ClassCastException.
  • In collection framework, TreeSet cast is an implementation for the SortedSet interface.
SortedSet interface extends Set interface inwards collection framework of coffee Java SortedSet Interface

Few of import as well as useful methods of SortedSet Interface are every bit bellow.
  • Comparator comparator( ) : It volition render the comparator which is used to guild the elements inwards invoking set. If elements of laid upwards are ordered using natural ordering as well as then it volition render null.
  • Object first( ) : It volition render the starting fourth dimension chemical component subdivision from the set.
  • SortedSet headSet(E toElement) : It volition render those elements from SortedSet which are  strictly less than toElement. toElement volition live non included.
  • Object last() : It volition render electrical current concluding chemical component subdivision from the set.
  • SortedSet subSet(E fromElement, eastward toElement) : It volition render laid upwards of elements from SortedSet starting from fromElement to toElement. fromElement volition live included simply toElement volition live excluded.
  • SortedSet tailSet(E fromElement) : It volition render laid upwards of elements starting from fromElement.
Usage of inwards a higher house SortedSet methods is described inwards below given example.

SortedSet Example :
package JAVAExamples;  import java.util.Iterator; import java.util.SortedSet; import java.util.TreeSet;  world cast SortedsetInterface {   world static void main(String[] args) {   // Create the sorted set.   SortedSet<String> s = novel TreeSet<String>();    // Add items to the sorted.   s.add("New York");   s.add("Delhi");   s.add("Tokyo");   s.add("London");   s.add("Mumbai");   s.add("Chennai");    // Iterate over the elements of laid upwards as well as print.   Iterator<String> it = s.iterator();   System.out.println("SortedSet Items are : ");   spell (it.hasNext()) {    Object chemical component subdivision = it.next();    System.out.println(element.toString());   }      //Get starting fourth dimension detail from set.   System.out.println("First detail inwards laid upwards : "+s.first());   //Get concluding detail from set.   System.out.println("Last detail inwards laid upwards : "+s.last());    // Using subSet method to become items from given FROM as well as TO elements of set.   // TO chemical component subdivision volition live excluded.   System.out.println("subSet items betwixt Delhi as well as New York : " + s.subSet("Delhi", "New York"));   // Using headSet method to become heading items from given item.   System.out.println("headSet from London : " + s.headSet("London"));   // Using tailSet method to become tailing items from given item.   System.out.println("tailSet from London : " + s.tailSet("London"));   // Check which comparator is used to variety elements.   // If render nada as well as then it has used natural ordering.   System.out.println(s.comparator());  } }

Output :
SortedSet Items are :  Chennai Delhi London Bombay New York Tokyo First detail inwards laid upwards : Chennai Last detail inwards laid upwards : Tokyo subSet items betwixt Delhi as well as New York : [Delhi, London, Mumbai] headSet from London : [Chennai, Delhi] tailSet from London : [London, Mumbai, New York, Tokyo] null

Java Treeset Class

Java Treeset Class

  • TreeSet is course of teaching nether Set interface of collection framework.
  • It implements NavigableSet interface which extends SortedSet interface.
  • Elements are ordered by a Comparator which is provided at laid creation fourth dimension or yesteryear natural ordering.
  • It maintains the ascending sorting order.
  • TreeSet is non synchronized thence if multiple threads accessing it concurrently in addition to whatever i modifies laid entry in addition to thence it must live synchronized externally.
  • Element's access in addition to retrieval fourth dimension is really fast from TreeSet thence it volition much useful when you lot wants to shop large information inwards ascending social club in addition to hollo back whatever chemical cistron quickly.
TreeSet is course of teaching nether Set interface of collection framework Java TreeSet Class
Important methods of TreeSet course of teaching are equally below.
  • boolean add(E e) : It volition insert specified chemical cistron inwards TreeSet if it is non already exist.
  • boolean addAll(Collection<? extends E> c) : It volition insert all entries of specified collection inwards to TressSet.
  • E ceiling(E e) : Get to the lowest degree chemical cistron from the laid which is greater than or equals to the given chemical cistron E. If non institute whatever in addition to thence it volition render null.
  • void clear() : It volition take away all elements from set.
  • Object clone() : It volition render shallow re-create of this Set instance
  • Comparator<? super E> comparator() : It volition render the comparator if whatever used to social club the elements inwards this set. Return goose egg if laid is sorted using natural ordering.
  • boolean contains(Object o) : It volition render truthful if specified chemical cistron is available inwards list.
  • Iterator<E> descendingIterator() : It volition render the descending social club iterator over the set.
  • NavigableSet<E> descendingSet() : It volition render contrary social club thought of laid elements.
  • E first() : It volition render electrical flow receive down chemical cistron from set.
  • E floor(E e) : It volition render you lot greatest chemical cistron from the laid which is less than or equals to the specified element. If non institute whatever in addition to thence it volition render null.
  • SortedSet<E> headSet(E toElement) : It volition render subdivision of laid elements which are strictly less than given toElement.
  • NavigableSet<E> headSet(E toElement, boolean inclusive) : It volition render subdivision of laid elements which are less than given toElement. toElement volition live included if inclusive is true.
  • E higher(E e) : It volition render to the lowest degree chemical cistron from laid which is strictly greater than the specified element. Return goose egg fi non institute any.
  • boolean isEmpty() : It volition render truthful if TreeSet is empty.
  • Iterator<E> iterator() : It volition render the iterator over elements of set.
  • E last() : It volition render terminal chemical cistron from set.
  • E lower(E e) : It volition render greatest chemical cistron from laid which is strictly less than the given element. If non institute whatever in addition to thence it volition render null.
  • E pollFirst() : It volition access in addition to take away receive down (lowest) chemical cistron from the set. If laid is empty in addition to thence it volition render null.
  • E pollLast() : It volition access in addition to take away terminal (highest) chemical cistron from the set. If laid is empty in addition to thence it volition render null.
  • boolean remove(Object o) : It volition take away given chemical cistron from the set(if it is preset).
  • int size() :It volition render size of set.
  • NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) : It volition render subdivision of laid starting from fromElement to toElement. fromElement volition live included inwards laid subdivision if fromInclusive is true. toElement volition live included inwards laid subdivision if toInclusive is true.
  • SortedSet<E> subSet(E fromElement, E toElement) : It volition render subdivision of laid starting from fromElement(Included) to toElement(Excluded).
  • SortedSet<E> tailSet(E fromElement) : It volition render tail laid starting from fromElement. fromElement volition live included inwards set.
  • NavigableSet<E> tailSet(E fromElement, boolean inclusive) : It volition render tail laid starting from fromElement. fromElement volition live included inwards laid if inclusive is true.
Below given representative volition demo you lot usage of few TreeSet class's method's demo.

TreeSet Example :
package JAVAExamples;  import java.util.Iterator; import java.util.TreeSet;  populace course of teaching TreeSetExample {   populace static void main(String[] args) {   // Create TreeSet.   TreeSet<Integer> ts = novel TreeSet<Integer>();   // Add elements inwards TreeSet.   ts.add(5);   ts.add(79);   ts.add(9);   ts.add(52);   ts.add(3);   ts.add(69);   ts.add(52);   ts.add(76);   ts.add(15);   ts.add(42);   ts.add(93);   ts.add(334);    // Print TreeSet.   System.out.println("TreeSet elements are : " + ts);   // Get ceiling value from treeset.   System.out.println("ceiling of 45 inwards treeset is : " + ts.ceiling(45));   // Get clone of treeset.   System.out.println("clone of treeset is : " + ts.clone());   // Check if treeset contains given element.   System.out.println("treeset contains 76? : " + ts.contains(76));    // Print treeset inwards descending order.   Iterator iterator;   iterator = ts.descendingIterator();   System.out.println("Tree laid information inwards descending order: ");   spell (iterator.hasNext()) {    System.out.println(iterator.next() + " ");   }    // Get receive down chemical cistron from treeset.   System.out.println("First chemical cistron inwards treeset is : " + ts.first());   // Get terminal chemical cistron from treeset.   System.out.println("Last chemical cistron inwards treeset is : " + ts.last());   // Get flooring chemical cistron from treeset.   System.out.println("floor chemical cistron of 51 is : " + ts.floor(51));   // Get size of treeset.   System.out.println("Size of treeset is : " + ts.size());   // Remove receive down chemical cistron from treeset.   ts.pollFirst();   System.out.println("TreeSet elements later pollFirst : " + ts);   // Remove terminal chemical cistron from treeset.   ts.pollLast();   System.out.println("TreeSet elements later pollLast : " + ts);   // Get tailset exclusive fromElement.   System.out.println("tail laid from 69 is : " + ts.tailSet(69, false));   // Get subset exclusive fromElement in addition to toElement.   System.out.println("subset laid from ix in addition to 76 exclusive is : "+ ts.subSet(9, false, 76, false));   // Get subset inclusive fromElement in addition to toElement.   System.out.println("subset laid from ix in addition to 76 inclusive is : "+ ts.subSet(9, true, 76, true));  } }

Output :
TreeSet elements are : [3, 5, 9, 15, 42, 52, 69, 76, 79, 93, 334] ceiling of 45 inwards treeset is : 52 clone of treeset is : [3, 5, 9, 15, 42, 52, 69, 76, 79, 93, 334] treeset contains 76? : truthful Tree laid information inwards descending order:  334  93  79  76  69  52  42  xv  ix  v  iii  First chemical cistron inwards treeset is : iii Last chemical cistron inwards treeset is : 334 flooring chemical cistron of 51 is : 42 Size of treeset is : eleven TreeSet elements later pollFirst : [5, 9, 15, 42, 52, 69, 76, 79, 93, 334] TreeSet elements later pollLast : [5, 9, 15, 42, 52, 69, 76, 79, 93] tail laid from 69 is : [76, 79, 93] subset laid from ix in addition to 76 exclusive is : [15, 42, 52, 69] subset laid from ix in addition to 76 inclusive is : [9, 15, 42, 52, 69, 76]

Friday, February 19, 2016

no image

Java Map Interface

  • Java Map interface represents the mapping betwixt unique keys to values.
  • Map tin forcefulness out non concur duplicate values.
  • In Map interface, Each fundamental tin forcefulness out map at close ane value.
  • Each Map interface provides iii unlike collection views. Using which you lot tin forcefulness out sentiment map's content every bit a laid of keys, collection of values together with laid of key-value mappings.
  • Map volition helps you lot when you lot wants to search, update or delete elements based on it's key.
  • The map interface is implemented past times unlike coffee classes similar HashTable, HashMap together with TreeMap.
Map interface has below given unlike methods.
  • void clear() : This method volition take all the mappings from this map.
  • boolean containsKey(Object key) : It volition render truthful if map has mapping for specified key.
  • boolean containsValue(Object value) : It volition render truthful if whatever fundamental of map has specified value.
  • Set<Map.Entry<K,V>> entrySet() : It volition render laid sentiment of map.
  • boolean equals(Object o) : It volition compare map alongside specified value for equality.
  • V get(Object key) : It volition render value which is mapped alongside specified key. Return zippo if no mapping constitute for key.
  • int hashCode() : It volition render hash code value of the electrical current map.
  • boolean isEmpty() : It volition render truthful if no key-value mapping constitute inwards map.
  • Set<K> keySet() : It volition render map keys inwards laid view.
  • V put(K key, V value) : It volition lay specified value alongside specified fundamental inwards map.
  • void putAll(Map<? extends K,? extends V> m) : It volition re-create all key-values mapping to this map.
  • V remove(Object key) : It volition take mapping for specified fundamental from this map.
  • int size() :It volition render full release of key-value mappings inwards this map.
  • Collection<V> values() :It volition render collection sentiment of map values.
I accept prepared sample illustration to present you lot utilisation of unlike methods of Map interface.

Map Interface Example
package JAVAExamples;  import java.util.HashMap; import java.util.Iterator; import java.util.Map;  populace shape MapExample {   populace static void main(String[] args) {   // practise Map.   Map<Integer, String> 1000 = novel HashMap<Integer, String>();   // Add fundamental alongside value inwards map.   m.put(3,"three");   m.put(7,"seven");   m.put(1,"one");   m.put(5,"five");   m.put(2,"two");    m.put(8,"eight");   m.put(11,"eleven");    // Get size of map.   System.out.println("Map size is : " + m.size());     //Check if map is empty.   System.out.println("Map is empty? : "+m.isEmpty());      //Remove mapping from map.   m.remove(3);   System.out.println("Map value later removing mapping of fundamental 3 : "+m);      //Get value from map for specified key.   System.out.println("Value for fundamental 5 is : "+m.get(5));      //Iterating over map.   Iterator<Integer> keySetIterator = m.keySet().iterator();   while(keySetIterator.hasNext()){     Integer fundamental = keySetIterator.next();     System.out.println("key: " + fundamental + " value: " + m.get(key));   }    //Check if map contains specified key.   System.out.println("Map has fundamental 7 ? : "+m.containsKey(7));    //Check if map contains specified value.   System.out.println("Map has value xx ? : "+m.containsValue("twenty"));  } }

Output :
Map size is : 7 Map is empty? : imitation Map value later removing mapping of fundamental 3 : {1=one, 2=two, 5=five, 7=seven, 8=eight, 11=eleven} Value for fundamental 5 is : 5 key: 1 value: ane key: 2 value: 2 key: 5 value: 5 key: 7 value: vii key: 8 value: 8 key: 11 value: 11 Map has fundamental 7 ? : truthful Map has value xx ? : false
no image

Java Hashmap Class

  • Is is pronounced every bit HashMap because It is hash tabular array based implementation of map interface.
  • It extends AbstractMap shape together with implements Map interface.
  • It allows to shop null fundamental together with null values.
  • It is non synchronized implementation hence if multiple threads accessing it concurrently together with whatever i of them modifies it together with then it must live on synchronized externally.
  • It does non guarantee of maintaining the map order.
Important methods of HashMap Class are every bit below.
  • void clear() : It volition take away together with clear all mapping entries from map.
  • Object clone() : It volition supply you lot shallow re-create of this map.
  • boolean containsKey(Object key) : It volition depository fiscal establishment tally together with render truthful if specified fundamental has whatever mapping inwards this map.
  • boolean containsValue(Object value) : It volition depository fiscal establishment tally together with render truthful if whatever fundamental has mapping alongside given value.
  • Set<Map.Entry<K,V>> entrySet() : It volition render the gear upwards thought of mapping.
  • V get(Object key) : teach method is used for retrieving value of specified fundamental from this map. If no mapping found, It volition render null.
  • boolean isEmpty() : It volition depository fiscal establishment tally together with render truthful if map is empty.
  • Set<K> keySet() : It volition render gear upwards thought of the keys of this map.
  • V put(K key, V value) : It volition associate specified fundamental value mapping inwards this map.
  • void putAll(Map<? extends K,? extends V> m) : It volition re-create all key-value mapping yoke of specified map to this map.
  • V remove(Object key) : It volition take away mapping of specified fundamental from this map.
  • int size() :It volition render size of this map.
  • Collection<V> values() : It volition render collection thought of map values.

HashMapExample :
package JAVAExamples;  import java.util.HashMap; import java.util.Iterator; import java.util.Map;  world shape HashMapExample {   world static void main(String[] args) {   // practise Map   Map<Integer, String> k = novel HashMap<Integer, String>();   // Add fundamental alongside value inwards map.   m.put(3,"Chicago");   m.put(7,"Mumbai");   m.put(1,"Tokyo");   m.put(5,"Delhi");   m.put(2,"Paris");    m.put(8,"Beijing");   m.put(11,"Berlin");    //Print map   System.out.println("Map : "+m);   // Get size of map.   System.out.println("Map size is : " + m.size());     //Check if map is empty.   System.out.println("Map is empty? : "+m.isEmpty());      //Remove mapping from map.   m.remove(3);   System.out.println("Map value later removing mapping of fundamental three : "+m);      //Get value from map for specified key.   System.out.println("Value for fundamental v is : "+m.get(5));      //Iterating over map.   Iterator<Integer> keySetIterator = m.keySet().iterator();   while(keySetIterator.hasNext()){     Integer fundamental = keySetIterator.next();     System.out.println("key: " + fundamental + " value: " + m.get(key));   }    //Check if map contains specified key.   System.out.println("Map has fundamental vii ? : "+m.containsKey(7));    //Check if map contains specified value.   System.out.println("Map has value xx ? : "+m.containsValue("Ahmedabad"));  } }

Output :
Map : {1=Tokyo, 2=Paris, 3=Chicago, 5=Delhi, 7=Mumbai, 8=Beijing, 11=Berlin} Map size is : vii Map is empty? : fake Map value later removing mapping of fundamental three : {1=Tokyo, 2=Paris, 5=Delhi, 7=Mumbai, 8=Beijing, 11=Berlin} Value for fundamental v is : Delhi key: 1 value: Tokyo key: ii value: Paris key: v value: Delhi key: vii value: Bombay key: 8 value: Beijing key: eleven value: Berlin Map has fundamental vii ? : truthful Map has value xx ? : false

Thursday, February 18, 2016

no image

Linkedhashmap Course Of Report Inwards Java

  • LinkedHashMap cast is i of the cast of map interface which extends HashMap cast as well as implements Map interface.
  • It is combination of linked listing and Hash table implementation of the Map interface as well as that's why it is called LinkedHashMap.
  • It is maintaining doubly-linked listing insertion companionship inwards which keys were inserted into the map.
  • It allows to shop nix elements as well as optional Map operations are likewise available.
  • It is non synchronized implementation therefore if whatever thread modifies map structurally when map is accessed past times multiple threads as well as therefore it must live on synchronized externally.
Important methods of LinkedHashMap class

  • void clear() : It volition take away all mappings from map.
  • boolean containsValue(Object value) : It volition banking concern stand upward for for value inwards map as well as supply truthful if values be inwards map.
  • V get(Object key) : It volition supply value which is mapped amongst specified fundamental inwards map. Else it volition supply null.
  • protected boolean removeEldestEntry(Map.Entry<K,V> eldest) : It will returns truthful if this map should take away its eldest entry.
ExampleLinkedHashMap
package JAVAExamples;  import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Set;  populace cast ExampleLinkedHashMap {   populace static void main(String[] args) {   // Create a hash map.   LinkedHashMap<String, Double> fifty = novel LinkedHashMap<String, Double>();   // Put elements to the map.   l.put("Bicycle", novel Double(134.33));   l.put("Car", novel Double(353.12));   l.put("Bus", novel Double(-598.23));   l.put("Train", novel Double(193.56));   l.put("Motorcycle", novel Double(39.48));    // Print LinkedHashMap.   System.out.println("LinkedHashMap elements are : " + l);    // Get size of LinkedHashMap.   System.out.println("Size of LinkedHashMap is : " + l.size());    // Get value of key.   System.out.println("Value of Bus is " + l.get("Bus"));    // Check if LinkedHashMap is empty.   System.out.println("LinkedHashMap is empty? : " + l.isEmpty());    // Check of LinkedHashMap has given value or not   System.out.println("LinkedHashMap has 353.12 value? : "+ l.containsValue(353.12));    // Check of LinkedHashMap has given fundamental or not   System.out.println("LinkedHashMap has taxi key? : "+ l.containsKey("taxi"));    // Iterate over LinkedHashMap.   Set<Entry<String, Double>> second = l.entrySet();   // Get an iterator   Iterator<Entry<String, Double>> i = s.iterator();   // Display elements   acre (i.hasNext()) {    Map.Entry one thousand = (Map.Entry) i.next();    System.out.print(m.getKey() + ": ");    System.out.println(m.getValue());   }   System.out.println();  } }

Output : 
LinkedHashMap elements are : {Bicycle=134.33, Car=353.12, Bus=-598.23, Train=193.56, Motorcycle=39.48} Size of LinkedHashMap is : five Value of Bus is -598.23 LinkedHashMap is empty? : imitation LinkedHashMap has 353.12 value? : truthful LinkedHashMap has taxi key? : imitation Bicycle: 134.33 Car: 353.12 Bus: -598.23 Train: 193.56 Motorcycle: 39.48
<< PREVIOUS || NEXT >>

Wednesday, February 17, 2016

Selenium Tutorial : The Path To The Driver Executable Must Live On Ready Past Times The Webdriver.Gecko.Driver Organisation Property

Selenium Tutorial : The Path To The Driver Executable Must Live On Ready Past Times The Webdriver.Gecko.Driver Organisation Property

Since end update of selenium 3, Most of the users(especially those who are novel amongst selenium) are facing mutual effect amongst fault "Exception inwards thread "main" java.lang.IllegalStateException: The path to the driver executable must move develop past times the webdriver.gecko.driver organisation property; for to a greater extent than information, encounter https://github.com/mozilla/geckodriver. The latest version tin lavatory move downloaded from https://github.com/mozilla/geckodriver/releases" when try to execute examination inwards firefox browser.

especially those who are novel amongst selenium Selenium Tutorial : The path to the driver executable must move develop past times the webdriver.gecko.driver organisation property


Configure Geckodriver In Selenium Test
This fault is bout downloading latest version of geckodriver exe in addition to configuring it amongst your selenium test. So, Lets encounter how to create it.

To resolve this issue,
  • You convey to download latest version of geckodriver from HERE
  • Download wi32 or win64 zippo file equally per your organisation configuration.

especially those who are novel amongst selenium Selenium Tutorial : The path to the driver executable must move develop past times the webdriver.gecko.driver organisation property

  • Now extract the zippo file.
  • You volition get geckodriver.exe from extracted folder.
  • Now Put geckodriver.exe in you lot E: drive.
  • Now you lot convey to render path of geckodriver.exe in your selenium examination using System.setProperty equally given inwards below given test.

import java.util.concurrent.TimeUnit; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver;   populace shape examination {   populace static void main(String[] args) {   //Set the path of geckodriver.exe.   System.setProperty("webdriver.gecko.driver","E:\\geckodriver.exe");     WebDriver driver = novel FirefoxDriver();     driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);     driver.get("http://www.google.com");         driver.quit();  } }

That is it. Your examination volition run smoothly straightaway inwards firefox browser.