Templates by BIGtheme NET

Guava’s String Helpers – Joiner, Splitter, CharMatcher and Charsets

fetured_image

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

main

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

fetured_image

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

fetured_image

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

fetured_image

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

fetured_image

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

fetured_image

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 »

Cleaner Code with Guava’s Preconditions

fetured_image

Description : There are more simpler and cleaner ways to avoid asserts and handling null checks. Guava’s Preconditions are used for checking method arguments, states, etc. When a condition is false the Precondition will throw the expected exception. The class Preconditions may throw IllegalArgumentException, NullPointerException, IllegalStateException and IndexOutOfBoundsException. Here are some examples that I took that can be shortened to ...

Read More »

An Overview of Guava

fetured_image

What’s Guava : 1) Extensive suite of common libraries that is used in many Java projects. 2) These utilities relate to: collections, concurrency, primitives, reflection, comparison, I/O, hashing, networking, strings, math, in-memory caching, in-memory publish/subscribe… and various basic data types. 3) JDK required is Java 6+. Before jumping to Guava, we will have brief about Functional Interfaces. These Functional Interfaces ...

Read More »