In this article, I will show you how lambda expressions can be used in projects and how these expressions are help to do clean coding. How to role out our own functions, and call those with lambda expressions. How these lambda expressions are differ from closures. Is lambda expressions are completely new feature in Java 8? – Answer is No ...
Read More »JAVA 8 Feature – Streams
In this article, I will show you how Streams java.util.stream can be useful with examples. Immediate questions comes to mind, Is it a new class in java collection framework? – Answer is NO Is it a new Interface in java collection framework? – Answer is NO Another question is, is it to be with java.io. package’s? – Answer is NO ...
Read More »Guava’s String Helpers – Joiner, Splitter, CharMatcher and Charsets
This article help to understand and best use of Guava’s string helper classes, Joiner, Splitter, CharMatcher and Charsets. Joiner and Splitter helper classes configuration methods will always return a new instance. This makes these classes as thread safe and can be usable as a static final constant. Joiner : Joining together a sequence of strings with a separator. To deal ...
Read More »TestNG groups attribute example
In this article, I am going to show you how “TestNG groups” allows grouping of test cases. How specific group or groups test cases can execute independently. How this groups can be defined? There are different criteria, that makes these groups. These groups can be defined based on, 1) Functionality 2) Customer Use cases (Some customer specific test cases) 3) ...
Read More »Maven install command is not working in eclipse
Some times we will end up following error, No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? In this case, we need to change the path Java -> Installed JREs path to point to jdk, instead of jre. Jdk should be set to system Path variable, without this given solution will ...
Read More »Google Guava Collections – Table
Continue to my tour with Guava Collections, Table is one of the use full Guava collection, First question is First. When should we use Table Collection? Suppose in some project, we are trying to index on more than one key at a time. Let me explain this, Suppose relation between Bank – Customer is many to many(M-M). 1) Bank can ...
Read More »Google Guava Collections – BiMap
Continue to my tour with Guava Collections, one collection that Enforcing uniqueness in Map values is BiMap( Bidirectional Map). Basic questions here, Is Bimap holds duplicate keys? – answer is No Is Bimap holds duplicate values? – answer is No Nice, key is unique and value is also unique. obviously is is 1-1 Mapping. More over, this help to handle ...
Read More »Google Guava Collections – MultiMap
Most of the time we are crazy about Map in java collections, In many projects extensively use lists & maps. Continue to my tour with Guava collections, MultiMap is one we should know. So let us starts with, What is MultiMap? A collection to map single key to either single or multiple values. Multimap addresses = ArrayListMultimap.create(); let me give ...
Read More »Google Guava Collections – MultiSets
Continuing this tour with Guava, MultiSets is a new collection class provided. So we start with What is a MultiSet? As it holds multiple instances of same type, then how union, intersection operations will work? Elements are Ordered or not? Allows duplicates or not? – Very straightforward answers is Yes What is a MultiSet? This is often called a bag. ...
Read More »Guave Collections
Some important collections in Guava, 1) Immutable collections 2) New collection types (Multiset, Multimap, BiMap, Table, ClassToInstanceMap and RangeSet) 3) Utility Classes (Iterables, Lists, Sets, Maps, Multisets, Multimaps and Tables) 4) Extension Utilities (Forwarding Decorators, PeekingIterator and AbstractIterator) 1) Immutable collections : Immutable objects have many advantages, 1) Safe for use by untrusted libraries. 2) Thread-safe: can be used by ...
Read More »