Introduction Comparing strings is a very common task in coding. How do we do that in Java ? well there are tons of content in that regard. I compiled the bare minimum that you need in case you are only looking for the syntax. Take a look… Syntax Summary Let us demonstrate that… Source code
Amicable Numbers Definition Two positive integer numbers (m, n) are amicable if the sum of the proper divisors of (m) is equal to (n) and the sum of the proper divisors of (n) is equal to (m). A proper divisor of a number does not include the number itself. For example, the proper divisors of
Problem Given the signature of the method below. It receives a two dimensional array of strings. Provide implementation that iterates through each string in each sub-array in the order they are provided but it skips null values Solution We are dealing with a two dimensional array of strings so we need a proper way to
Problem Given the Java method signature below. It receives an array of string iterators. The method should return a single string iterator that chains all iterators in order skipping null values Solution We wrap the array of iterators in a list that implements the iterable interface and override the hasNext, next and remove methods. hasNext:
Problem Given the signature of the Java method below Provide implementation that iterates through each string in the order that they are provided but it skips null values Solution We implement the Iterable interface. We add a class member variable to store the list values in an array of strings. We override hasNext, next and
Problem Given the cache interface below We want to implement a generic cache class in order to improve compile time type checking. Solution Using Java Generics one can provide variable types as parameters for compile time type checking. In this case we are going to use K for key and V for value as follows
Problem Given the Java cache interface below, write a singleton class that implements the interface so that no warnings are generated without using @SuppressWarnings annotations Solution The question is mainly about two points: Type checking warning must be fixed Singleton design pattern should be implemented here is how I approached the problem… I modified the map private
Introduction In this tutorial I will demonstrate how to integrate Sikuli (open source image based test automation tool) and Selenium (object based web automation framework) into Robot Framework (keyword and data driven test automation framework). This is not a Robot Framework Tutorial nor a Sikuli Tutorial. For more information about these technologies please visit their
Lexicographic Order Problem Write java method to compare two strings lexicographically. The method should return 0 if the two strings are Lexicographically equal. It should return 1 if the first string comes before the second string in the dictionary. It should return -1 if the first string comes after the second string in the dictionary.
Problem Write a Java method to replace a sub string in a given text with another string of the same size Solution Loop through the text character by character. Starting at the current character loop a number of times equal to the size of the sub string while comparing characters in the original text and the sub