The Secrets of Healthy Relationships

Hello Friends, Today, I just felt like expressing my thoughts on relationships. What I have learnt so far and that has helped me in keeping up with others, especially in my bad times. Whatever I am going to write below is my own personal veiws and doesn’t mean to disrespect or disregard what others think about it.

The Secret of a healthy relationship is way too simple, infact, it is so simple that people simply pass over or look for a way which is rather complicated. Well, that’s the tendency. Because, we like stuff which is more expensive in price rather than expensive in values.

Secret #1 – Look at the things the way they are…

This is really the most simplest thing to understand in order to pursue a good healthy relationship. We all have a tendency to create a perception of a person as we look at him/her. We start making moral judgements about the way he/she is dressed up, or the way he/she walks, the way he/she talks etc etc etc… the list goes on. All these things happens in less than 5 seconds. Our mind rushes through our past experience and beliefs to create a perception of that person based on his/her superficial aspects. Well, if you do this, Stop It Right Away!

Secret #2 – Be Concerned about your own-self

A Haryanvi sold a buffalo to a Punjabi. After a week or so the Punjabi frustratingly returns to Haryanvi and says — ‘Re Jaat ! Thaari bhains kaani hai’ (Dear Haryanvi ! Your buffalo has an eye issue).

To this the Haryanvi answers:-

‘Re sardar ! Tanney Bhains se Doodh kaadna hai ya Aaankh matakaa karna se’ (Are you to milk the buffalo or romance it in her eyes’?)

This is exactly what’s going on in this world. People are more concerned about things that don’t matter, rather than their own self. You must not waste your time thinking about the ‘people issues’ in your lives. Just stop for a moment and think, What good can come by wasting time thinking about other people issues? What if you take this time and rather think of all the ‘Raita’ in your own life. You can improve yourself by investing that time in yourself.

Secret #3 – Live to Enjoy not to Impress other

Do things which matters the most to you. Things which makes you happy and not something just to show off. We are not slaves. I believe that we all are here for a purpose, and that purpose is definitely not to impress others. Life is to live and enjoy and do all sorts of things which makes YOU happy and not others. Because, note one thing, you cannot do anything to make others happy unless they want to be (Kuch bhi Karlo, dusre ko khush tab tak nai kar sakte jab tak wo khud na hona chahe). That is the truth of life. So, stop wasting time to impress others and make your life enriching.

The above secrets are not really the secrets and we all have heard it somewhere or the other. But then, Why don’t we practice it, if we know it already. Just live life the way it is. Nothing Lasts forever, so live it up…drink it down…laugh it off….avoid the bullshit & never have regrets becoz at one point everything you did was exactly what you wanted… Life is a celebration.. Keep on celebrating… And remember that the FAILURE is SUCCESS IN PROGRESS. If you liked this article then you must also go through this article posted by Priyanka Yadav on How to Keep Your Relationship Moving Forward

And As Always,

Cheers smiley


A brief Introduction about Gradle

Hey guys, Have you seen black art, well, here’s the truth – Besides black art, there is only automation and mechanisation. It’s this era, there is a new name for magic, its called Automation . Each and everything is being automated to save extra efforts and time and that too without the cost of accuracy. Isn’t it cool? This article is going to be short and interesting one. If you know about Gradle then maybe it won’t be that much interesting to you but hey! Who doesn’t like magic??

What is Gradle?

Gradle Icon

If I have to explain Gradle in short and not in a fun way then I would say that – Gradle is a Build Automation Tool.

Now let’s slowly dig down the meaning of those words… Gradle is nothing but a very powerful tool to achieve Build Automation. It’s important that we understand Build Automation before getting into the ways to achieve it.


What is Build Automation?

Build automation is the process of automating the creation of a software build and the associated processes including: compiling computer source code into binary code, packaging binary code, and running automated tests.

If you want to know more in details about getting started with gradle then follow this article: org/current/userguide/userguide.html

Why we need Build Automation?

Maybe because of these reasons:


  1. People don’t know the process and that becomes a problem

    In large organization there is a miscommunication between people and teams that could take up loads of time. With Build Automation, a single person can sit and outline all the required steps to deploy the project. Create a nice document side-by-side and finally create a template and test it on database. Once everything is working fine, publish that document to your team so that they will follow the exact same thing required to deploy the project. This way there will be a process to follow…
  2. Time spent in fixing a fault is costly, so better avoid it

    I understand that fault is a part of a Software Development phase and it’s hard to avoid. But what if the time required for fault management stretches more than the project development time. Then it is not fruitful at all. How good it would be if there is a set of document for everything that people can follow and  avoid the common bugs and pitfalls.

  3. A single admin to administer the build, hence, more control

    At times there are single admin with multiple developers working on the deployment process. The deployment experience should be same for all the developers. Therefore, a new documented outline will give admin more power over the entire deployment process.

  4. Manual is risky

    I don’t think this point needs explanation :p

So, now that we know what is Build Automation and why we need it, we can better understand the ways of achieving it.


Gradle Build Tool

From a long time the only requirement of a Build tool has been to compile the source files and package them. But as business requirements has evolved overtime the responsibility of a build tool has also increased. A build tool has to work with multiple projects and multiple languages together and has to apply broad spectrum of testing. Gradle comes into the picture.

Gradle is a JVM based build tool and it makes use of the lessons learned from the earlier build automation tools such as Ant and Maven and did not force the developer to write configurations in XML files. Following a build-by-convention approach, Gradle allows for declarative modelling your problem domain using a powerful and expressive domain-specific language (DSL) implemented in Groovy instead of XML. Because Gradle is a JVM native, it allows you to write custom logic in the language you’re most comfortable with, be it Java or Groovy.

Why Use Gradle?

Gradle will definitely help you in making tedious tasks easier without compromising with the flexibility, usability, extendability and performance. In any large size project with multiple dependencies managing these become difficult and cumbersome. Gradle makes it real easy to manage dependencies between multiple projects. Java projects normally depends on large number of dependencies and to manage such dependencies require advance tools which provides easy management with less configuration.

Maven is one such tool, it is also used to manage dependencies. It follows the paradigm of convention over configuration by introducing standardised project template and build life-cycle for Java projects. This approach is quite good but only if you want have a single convention. Imagine if you have a project with multiple conventions, then it becomes a problem. Maven has one such convention that there must be one JAR in every project structure. What if you want to produce 2 different JARs from the same project with different project structure, then it becomes quite difficult to achieve that with Maven. Sure you will get workarounds but then these workarounds doesn’t come that naturally to you.

Gradle has learned its lessons from these build tools and it makes it really easy to work with it or I can say that Gradle comes naturally to you. Below mentioned description will convince you to adopt Gradle and why should you use it now –

Gradle Less Code

How much less code does Gradle takes perform the exact same task done by Maven. On top of that it is more readable and uses the same language which you are used to.



If you are not using Gradle or haven’t used it before then I would recommend you to use it now. It is one of the best automation tool you will find out there. It’s very easy to use and more and more businesses are porting their projects to gradle. If you need help in convincing others about using it, then feel free to use the share buttons below. Please comment below for any discussion.

And as always

Be My Aficionado 🙂

Interview Attires for Men – How to dress for an Interview?

Hello guys, I know it’s high time for all the potential job seekers. This is a stressful time because you have to focus on lots of things at the same time. In this hassle you sometimes forget the things which values the most. Yes, I’m talking about your Interview Attires. Have you given it a thought yet? If you have been busy with other stuff and has forget to look at this side then maybe it is time. Do not leave it to the last moment. Just to make your task easy and smooth, I have written this article which will help you choose your favourite look. It is time to IMPRESS.

Interview Attire

Why should you care about the Interview Attires?

It’s all about your first impression. Selection is not completely based on the correct answers that you give in front of the interviewer but in the way you present it. Similarly, as soon as a person sees you, at that very moment your image is imprinted on that person’s mind. And you wouldn’t want it to be like an average guy. You should always leave good impression on the person’s mind at the very first sight. Science says that people decide 9 things on the first sight, I’m sure you wouldn’t like that to be negative. Therefore, pay close attention to the way you are going to present yourself… It could make a huge difference. You cannot be lucky every day but you can look good 😉

Men Interview Attire

Men style of dressing has been quite static over the years. It is pretty much the same whether you are applying for the higher post or the entry level post. Just the weight of fabric varies.

Suit Style

You should directly go for a solid Navy suit. A Solid Navy will never turn anyone off and on top of that you don’t want to be too showy, or come out too strong. Do not go for a black or tan suit, however, they look great but these are not appropriate for the interviews unless you are going for some TV interview where you have to come out strong and gglamorous Avoid blazers or jackets as these doesn’t look very formal and gives you more of casual look. A suit is what you should choose for your interview. Here are some collections I chose from the amazon store to narrow your choice,

Shirt & Tie

Pretty Straight-forward call it is – Go with the 100% White Cotton Shirt. Yes, it should be white… There are numerous reason why you should choose white shirt in an interview instead of any other color. Wear a simple shirt and by simple I mean plain traditional shirt without tab collars or Wide English Spread collars. Keep it simple and traditional. That would make you look elegant and handsome. Just stick with that. I’m forcing white so much because it sends subliminal message to the observer’s mind and gives a sense of cleanliness, simplicity, goodness and politeness.

I think it’s a good idea to invest a few bucks on your new Shirt as it is really going to make a difference. Here are some of the picks from the amazon store,

The second important thing that could drastically compliment your attire is your Tie. It is not mandatory but if chose correctly can dramatically improve your entire look. You just have to choose a Tie that compliments your look. There is a vast range available that can go with your look. An all-over, neat pattern, a small dot or a classic stripe all work well. Just make sure you do not go with extremely bright colors. Keep is simple and elegant. I have narrowed down your choice to a few of these, choose what your heart feels right 😉


It’s quite simple to choose a shoes that goes with the formal suit. You simply have to match the color of your shoes with your belt and it’s an overall match. If you are going with the navy blue suit and a white shirt then a black belt with matching shoes are really going to compliment your overall look. Again I have narrowed down your choices from a vast pool to a few…


Minimize it. I would suggest only a Watch to go with and that’s it. No other thing is required.
Women Interview Attire


I really believe in getting dressed well and appropriate as it opens up wide range of opportunities for you at any given moment. This article is for all of you who are going to face the interview for the first time just so you can get it straight without much hassle. I hope this will help you in choosing the right attire for interview. If you liked it then share and comment below… Do not forget to subscribe.


And as always,

Be My Aficionado 🙂

Freshers’ Journey to an IT Company – The Life of a Fresher

Hey Freshers, how are you feeling? Wait… I know. You are feeling excited for a new IT  Company thinking how awesome it is going to be when you will earn your first bucks. You start creating your own castle of dreams and how your life would transform after that. Ahem ahem… this article is going to be a wake-up call for you all. I will be talking about the collective experience of different people in this article including myself. Hope you will have a look inside a freshers life in an IT Company.


During the last week from your joining date



If you have always lived with your parents in your own house then you will definitely get a weird feeling of leaving them. The feeling is difficult to explain in words but it is similar to the situation depicted in Jab We Met when Kareena Kapoor says “Jaise koi Train Choot Rahi Ho”. Suddenly, you will want to spend more quality time with your parents. And you will receive a similar reaction from them too.


When the day comes…


When the day comes, it is time to say goodbye to your family because you are going to start a new life. Your dad or sometimes even mum will accompany you to the new city. Everything seems so beautiful. You travel to a new city, you see IT Parks with mega structures of which you are going to a part soon. Then the company offers you accommodation in some hotel room with 3-star facilities or sometimes it’s a bungalow.

Your life takes a hike from feeling average to extraordinary. And you should feel that way because your company wants you to feel that way. A feel of a super luxury lifestyle. It is exactly what you wanted in the first place? Isn’t it? Well, this is the best part of the whole process. You get a feel, it’s maybe temporary but it leaves an impression on you for a lifetime and motivates you to make it permanent. This is probably the most important part of an individual’s life. No matter where he/she has come from… mere feeling of becoming independent earner becomes one of the best moment of your life. But if you will closely observe yourself, you will also find a feeling of insecurity… We’ll see Why?





It is your joining date today. You have to reach office at 9:00 AM probably. You wake up early, start preparing for your first day of joining. A lot is going on in your mind at this moment. Some of the collective thoughts that I was able to dig out from people around me were like:


  • How am I going to reach there?
  • Where would I go after I reach there?
  • Am I looking Good enough to make my first impression?
  • Should I visit a temple on my way there?
  • Should I take my parents with me or not?
  • Taxi or Auto (it’s always taxi :D)
  • Revise all the documents which you will need there…
  • Jo Hoga Dekha Jaega?
  • And the list goes on…

You seriously start thinking individually. The only person visible to you at that time is YOU.


You reach your destination. You look many people similar to you, who probably might be thinking same as you are. And then all the question clears out. Now, you have other people with you on the same ground. You are not alone anymore. You get inside in a group. And the usual process begins…



It’s time for induction. Once you reach inside the building, you will see a known face welcoming you. It is almost the same everywhere. You are ought to find someone who you have seen before during the interviews or seminars or something. The point is – The person will be known to you in some way or the other. He will brief you on the current situation and ask you to be seated. You will love that person by the way 😀

Now, you will be briefed about the different aspects of the company and people and the ethics and the moral and so on and on… Induction may extend from 2 days to a whole week.


It’s time for Freshers Training…

LONDON - NOVEMBER 03: Production staff on the weekly fashion magazine, Grazia edit the magazine in a temporary office inside the Westfield shopping centre on November 3, 2008 in London. For one week Grazia magazine is being produced in the Westfield shopping centre and are offering shoppers free make-overs, fashion consultations and advice on pursuing a modeling career. (Photo by Oli Scarff/Getty Images)

It is quite the same as your college days. You will go in the morning and come back in the evening. You will learn the same thing which you already have known but in a different way (practical way). On the basis of your training, you will get daily assignments and weekly assessments which you will have to clear in order to proceed further (it depends on the company). Training will be stretched for three months and meanwhile you will start exploring the city and post many pictures on facebook showing the world how happy you are :D. This is the best part. You are not under any pressure and you have lots of time for yourself. Just make it count. You won’t get this period ever after.

After the Training…


Finally, the training has come to an end. It is the time when you will be relocated to the different location. Your friends will be left behind (behind means in a different place). Again, this time, you are alone. You will visit a new place with new faces all around. The feeling will be quite the same but this time, you will know what is going to happen and you will cope up with it patiently and peacefully. You will be assigned a 4X4 cabin where you will have your own workstations setup with a name slip in the front and a phone on your desk. We all have seen this in the movies. It is exactly the same. It’s exciting for the first time, as you have seen this in the movies already. But, sooner or later it starts to get monotonous. Everyday is the same. You follow the same cycle every day:


  • Wakeup
  • Get ready
  • Travel to office
  • Be at office (10 to 7++)
  • Travel back home
  • Eat food
  • Sleep
  • Repeat

Wow, it’s so predictable, Isn’t it? You already know, what’s going to happen with you in the coming days. This is the scenario of every major IT Company in India. It is quite different with the startup companies where you are concerned with lots of different things and you have to take responsibility and the job becomes fun but in mega companies, you will have people around you to take the burden off your shoulders and thus job becomes bored. You won’t learn as much as you should be. Start-ups let you learn a lot in a very  short time but if you have already started big then the learning curve smoothes. That’s why all the IITIANs are involved with the major start-ups in India and not the people who are working in the big IT Companies from the start of their careers.



This was just an eagle eye view of the experience from different people who have been there in your shoes. This article was intended for you to learn as much as you can from the experience of others.  There is a lot that happens, for ex- your first salary. I really want you to experience all these things in your coming years but just observe yourself all the time and be different. Don’t be a crowd, be the creator of it. I also want to talk about the financial knowledge which is going to be very important for you in these coming years. Maybe, I will dedicate an entire article for that. Just let me know how you liked about this article in the comments below.


And as always,

Be My Aficionado 🙂

How to become a good Web Developer

Hey guys! Recently, I have been getting a lot of queries on how to become a good web developer or which road leads to web development. First of all, I couldn’t be any happier that you are interested in Web Development and I’m sure there is a pretty nice reason for you to be a web developer. I think this article is going to be an interesting one for all the budding web developers. Let’s begin the journey…


What makes you a Web Developer ?

web developer

Have you ever asked this question to yourself… What is it that motivates you to become a web developer. Is it due to some necessity or a driving passion. Is it that you have some goal to achieve which requires web development skills? I’m sure there could be thousands of reason behind your motive. But one thing that is the most important of all is your passion for at least one of the countless aspects of Web Development in its entirety. If you genuinely have that passion, then you are already one step closer to your Goal.

There are lots of problems that will come in your way and the only way you can overcome it is your passion. No developer in this world has a smooth career. There are bigger challenges than you can ever imagine, but to come out from that situation, requires more than your skills and knowledge. That’s where your passion comes in to rescue you. So, if you are not passionate for it, then you should probably step back.


Know Your Motive…

web developer

It is a prerequisite. You must know your motive behind learning to code. One of the most scariest thing I have seen happen to people who are just starting to code is that they are told it is easy. To be very clear- “Programming is NOT EASY”. I have experienced it and still experiencing it every day. Here’s an exceptionally hilarious Kate Ray’s post on techcrunch that depicts your inability to code :p

I have seen people stuck on a problem for days and then finally when they get the solution, they are not in the state to explain it. Because they don’t know how and why they did what they did.

my code is working I dont know why? My code is not working I dont know why?

This is the situation of an experienced programmer. For someone who is learning to code, there is no need of a discussion. They are dumb as a duck (Quack Quack). There is no one to solve their problems because there problems doesn’t qualify as a problem. They often end up asking dumb questions. And I salute those teachers who take the responsibility to teach people how to code.  

To become a Web Developer, you must train your brain in such a way that it is ready to learn new stuff constantly, face any failure and don’t give up. For this purpose, you must be very clear with your motives that guides you. At the end of the day, this is the ultimate source of energy that will help you move forward.


How to Learn?

learn to become a web developer

To answer this question, you must ask another question – “What to Learn?”. Once you know what to learn, you can ask the question how to learn it. So, What to Learn?

There are tons of things that you need to learn to become a Web Developer. But don’t worry, you do not have to learn all at once. It is a process that starts from step one and consequently increases with your knowledge. There are five things that you must learn before stepping into something bigger.


  • HTML + HTML 5 (Hyper-text Markup Language)
    This is the very first requirement in order to create web pages. Without HTML you cannot move ahead. HTML 5 is fairly new and it comes with lots of API’s (Application Programming Interface) that helps you quickly develop lots of stuff which use to take up lots of time in coding. Some of the API’s in HTML 5 are –

    1. Drag and Drop
    2. Local Storage
    3. Application Cache
    4. Web Workers
    5. SSE
    6. Geolocation
  • CSS
    HTML pages without CSS is like Actresses without makeup. You need CSS in order give style to your page and make it user friendly for the eyes. With CSS 3 you can also develop responsive website which will work flawlessly on all screen sizes. By the way CSS stands for Cascadding Style Sheets.
    Yet another important thing to learn if you want to become a Web Developer. Javascript is language of the web. Everyone who has ever developed a website after 2009 would have used it in some way or the other. JavaScript is the scripting language of the browser. It performs several functions in enhancing the overall User Experience of the website.
  • Server Side Language
    It is a must requirement if you wish to create a dynamic website and which is going to interact correspondingly to the user’s action. A good knowledge of any one of the server side language is mandatory from the vast pool of languages. I recommend you to learn Php or Python if you want quick results.

    The learning curve with these languages is not very steep and will come naturally to you once you start with it. Other language that is used as a server side programming languages include:

    • Swift
    • Php
    • Python
    • Ruby
    • Java
    • Scala, etc
  • Database
    If you are going to create a dynamic web application that will have registration or login or which will store some kind of data to then you are definitely going to need a database for this purpose. For this you must learn SQL (Structured Query Language) to talk to any database. There are tons open source database present out there. One of the most popular database is MySql. Php and MySql are like boyfriend-girlfriend, they are made for each other. I would suggest you to start with MySql as it is free and very easy to setup. For this you must train yourself in SQL.


This was the list of things that you need to learn in order to move in the direction of becoming a Web Developer. Now, let’s come to the most important part, which is, how to learn these things?


How… ?

Online Tutorials…

online tutorials

Well, as I said there is no easy way to learn anything. You will have to give your time and energy to acquire these skills. Let’s assume you have adequate amount of time and energy to do it… In that case, you must start digging the web for knowledge. Everything is there on the net which will help you to begin your journey. There are tons of tutorials present on the web which will all promise to make you the master of web in a week. Maybe their promises are fake but you will definitely learn something from those tutorials. Here are a few tips which you should keep in mind to gain the maximum benefits from tutorial –

  1. Find a new tutorial of your niche.
  2. Go through each and every part of the tutorial even though it is boring.
  3. Follow the tutorial as it is. Do not try to manipulate it in your own ways. Try to understand what it says and complete the steps as mentioned in the tutorial. It would be best if you write the code given in the tutorials by yourself (I know you will do ctrl + c & v).
  4. Once you are done with the tutorial, try to re do it. This time try to make minor changes to it and manipulate the functioning of that application. Make sure you be in the limits of what you are being taught 😀
  5. Repeat step 1-5.


Buy lots of books…

This is by far the most trusted way to teach yourself how to code. Make friends with books. There is immense amount of knowledge in the books. You also get to learn from the experience of a developer who has been there in your situation and understands you better. You will get to relate better and learn from the mistakes of a writer. Books are one of the ultimate way to train yourself in something. It is the same for programming too. Here are some of the books that you will find useful…



These are the books that will cover each and every aspect of Web Development. Once you have gone through these books you will be able to create complex applications on your own.

Find a Mentor

Tutorials are a great way to learn and develop your skills. This will help you in the beginning stages when you are learning the basics of it. Once you are in a place where you have to cope up with some real world problems then tutorials ain’t gonna help you. You need to find a mentor who has been there and did the same. Who can enlighten you with his or her knowledge or share his experience. You cannot do everything on your own (talking from the personal experience). That’s why there are books but the problem with books is that you have to read it and it takes time :p. A mentor on the other hand can make solve your query faster.  


Finding mentor is not a hard thing to do in this fast paced world of internet. You just need to interact as much as you can with the people of same genre. Become an active member of matching community. Make friends, share your problems often with everyone who seems to understand. I know these advices do look like philosophical talks but after-all it is all same. Once you are have acquired the right set of skills and knowledge and people around you. The path to ultimate goal will become clear.



To summarise all in a few lines, Web development is quite easy only if you have acquired the skills and knowledge. You must give your time and energy in mastering the different pieces of technology and combine them to create something magnificent. If you have any queries, feel free to contact me or comment below…


And as always,

Be My Aficionado 🙂


Simple Shopping Cart in JAVA using Collections

If you have read my previous article which solely focused on getting you started with the JAVA Collections framework then it’s time to dig a little deeper and create an application to demonstrate the use of Collections in real world application. I have chosen Shopping Cart application for this purpose because I found it perfect for the situation and the use of collection in this application will help you better in modelling real world applications.

Project Structure

1. Firstly create a new Java Project with whatever name you like.
2. Create the following package under your src folder,
3. For simplicity, all of the code will reside inside this package.

Classes Used


For this example project, make sure all of the above-mentioned classes resides under the same package, i.e, collections.shoppingcart. I will take each class one by one and explain the significance of each class.

Go through the code below,

This is a concrete class which contains Product properties and provides setters and getters for it. I have also override the Hash and Equals method in this class which you will realise later as we move forward.

Go through the code below,

The role of this class in your shopping cart application is just to provide you with the store products. In other words, this class is used to initialize your store as soon as the application is started. As you can see, the initStoreItems() methods is used to add the products into a new ArrayList which is the type Product. If you have read my previous article on Understanding Collections in JAVA then you will be familiar with the Generic Collection. As we have provided the Product class inside the <> braces as new ArrayList(), this will tell the compiler that the list is of type Product and it can only contain an item which belongs to type Product.

Go through the code below,

This is a concrete class which act as a cart to store the items temporarily into the cart. It provides the user with all the required operations that a cart should have such as addToCart(), removeFromCart() etc… It also maintains a cartItems list with a type Product, similar to the products list in products class. Its sole purpose is to store the purchased item into the cart, remove the item from the cart. It simply maintains the list of items which are added to the cart by the user.

Go through the code below,

This is the class where the main interaction between the user and application takes place. It is the control point of the application. Everything that you see in the console is a result of this page. It takes the user input and calls the respective methods from the classes that we made earlier to perform the required task. Simply go through the code and if you find a problem anywhere just comment below and I will be at your help. You may also comment below the code in GitHub, that way it will be more organized.


This is simply the starting point for the application. It calls the constructor of UI() from the main method which takes care of bootstrapping the entire application.


Your Shopping Cart application is fully working at this point of time. I hope the use of the collection is very clear. If there is any doubt or problem then you may contact me directly by commenting below. For simplicity, I have only used ArrayList, however, you may use any other data structure as per the need of the application. I suggest you follow the KISS principle every time you are given a project.

And as always,

Be My Aficionado 🙂

A Beginners Guide to Understand Collections in JAVA

Hello friends, in this article I’ll try to make collections very easy for you to understand. This is one of the easiest and yet misunderstood concept for the beginners. It is pretty easy to get started with collections but to understand the use of collections takes some experience and understanding of the real world problem modelling. What I mean to say here is that, beginners often misunderstood the use of collection where it is most important. That is a common scenario because it is hard for them to model real world problems into objects and collections rather than using an old procedural style.

As this article specifically belongs to the beginners, so I would start the way every other article or a beginner is briefed with and i.e, from the scratch and the definition of collections. It is Okay to leave this article if you think you know the theory/syntax and move directly to the other part of it where we will take on a real world problem and try to solve it using collections. I believe in the philosophy of doing things practically rather than theory. So, that is what we will do. Let’s get started…


What are Collections in JAVA?

Collections in JAVA is simply a framework that provides an architecture to store and retrieve a group of objects. It is a ready made data structure that stores group of objects and provides various different ways to manipulate it. It performs all the operations that you usually perform on a set of data, such as searching, sorting, insertion, deletion etc… It makes your task very easy and the best part – You don’t need to know the working behind it. Simply, learn to call the different methods and all hard part will be taken care by the framework itself.

To further elaborate, JAVA Collection simply means a single unit of objects. It also provides many different interfaces and classes to structure the data as needed. Most widely used interfaces are –

  1. Set
  2. List
  3. Map


It also provides many useful classes which implements one of these frameworks and provides the required functionality and behaviour. Some of the most widely used classes in JAVA Collection framework are –

  1. ArrayList
  2. Vector
  3. LinkedList
  4. HashSet
  5. HashMap
  6. TreeSet
  7. LinkedHashSet, etc…


Hierarchy of Collection Framework

You will find all the classes for collection framework in java.util package. This is how the interfaces and classes are linked with each other.


The Basics

Enough of the theory, as I said, I believe in getting hands dirty into the task that we are alloted with. It is time to get your hands dirty in code. Let’s learn the few basics that will help you in the second part of this article where we will model a real world problem.


How to use Collection Framework?

Glad you asked, as I said it is really very easy to get started with JAVA Collection. So, let’s quickly delve in…

Follow the class below…

For the time being, just go through the code and simply uncomment each line in the main method one-by-one and change the printList argument depending on the uncommented code. For ex- if you uncomment the c.setExample(); then change the argument of the cc.printList(c.set); . It will tell printList method about the type of which is being thrown at him and it will decide depending on the same. The above example was of the Non-generics collection types. In Non-generics, you can insert any type of object. It doesn’t restrict you before adding anything to it. However, this is not the right way to do. Eventually, you will end up writing lots of instanceof check in the code which is pretty ugly and most probably face lots of ClassCastException errors. Just to avoid these things and to make java more compiler friendly GENERICS were introduced.   Generics lets you define the type of object that it will store beforehand. So, if you want a list of names, then you can provide the type as String. This will restrict the entry of any unwanted object type which is not an instance of the class String. That way your code will look cleaner and much manageable. It will become easier to manage such a code in long runs. I will extend the above class file to  demonstrate the use of Generics in collection…


This article was intended to educate you on the use of collections framework in JAVA and how to get started with it. If you understood the concepts presented in this article then it’s time for a practical use of it. In the next article, you will learn the use of collections in real world applications. How to model application and use collections to make our jobs easier. Follow the link below,