A team is not a group of people who work together. A team is a group of people who trust each other. – Simon Sinek

team play

Friends, I would like to share my personal experience. I played volleyball with my colleagues for the first time as a team, and it was fun and fantastic. After learning a few basic shots on how to serve, lift and pass the ball, we started playing. We are a 5 person team taking different positions on the court. Once we receive the ball, we have up to three chances to handle and direct the ball to the other court without grounding on our side. The rule is no person should touch the ball twice consecutively; he/she should either pass to a team member or direct to the other side over the net to ground it.  All other team members are focusing on the ball, often shifting their positions with respect to the ball to take action. I constantly hear each team player calling other players name and asking him to touch the ball. You gain a point if other team fails to prevent the ball from grounding. I noticed when you pass the ball among your team players and attack for second or third pass, you have much control, and you can direct the ball precisely to the other court and increase the chance of gaining a point.

Key Observations:

  • I see every player in the team is relying on and trusting the other player he/she will take the ball when you pass.
  • Other players are always monitoring the ball and are ready to take action immediately.
  • All players in the team have a common goal to handle the ball properly, ground it the other side and gain a point, absolutely committed.
  • Sense of appreciation for each team member and genuine happiness among all the players.

Somewhere along the game, I realized I could relate these observations in my day-to-day life at work where we work with people. We have similar goals on delivering projects while meeting deadlines. We can also make this experience fun and fantastic. If you see how the ball must be sent to the other side of the court in only three times from one side, it is similar to how we have project deadlines.  Just as how a single person cannot hold the ball twice consecutively, any single team member cannot be overloaded with all the tasks and should trust his/her team members to handle the work. It is a great trust you are transferring, and the member who is ready to grab has even more responsibility to do their job and pass it on to another member.  Here, you trust the person more than any specific skill set. When we have this sense of trust among everyone we work with, our team achieves great results. Similarly, how players are shifting their places with respect to ball, can be compared to how each person takes a different role depending on the requirements.  When you win, all the team members share this genuine happiness, which is much bigger as it is a greater win with the team than a one person show winning by chance.

Losing a point can be related to missing any deadlines.  If we fail in sending the ball to the other side, every team member is accountable, and it is never a single person’s fault. When the ball is arriving into the court, a player might have pushed his limits to lift the ball and prevent it from grounding at first place. When he attempted, it went in a different direction where other players might not be expecting and the second player tries to reach and lift the ball. Everyone in the team is trying their best to lift and send the ball but it might fail, and it is not just a single person held accountable.  When working as a team with those whom you trust and who trust you, you always have support in solving problems, and as a team, we reach more optimal solutions.

team work, happy people

Above is a simple scenario where a person is trying to solve a problem how he can connect and store those triangle pieces with minimum area. You shouldn’t stack them as it might cause scratches or it cannot tolerate weight on it.  From the picture in left half, one person is thinking hard to solve this. Other team member got an idea and they worked together, so they numbered the pieces and formed a square.  Now for a single problem two brains are working collectively and got an optimal solution. The result is both are happy for solving it and its a collective thought of two people.



“When I was reading the above story and discussing with my friends, colleagues, I observed some interesting facts why we are not like a team in Volleyball. One thing I heard is each person can have different motives and targets where he wants to reach in his career and may want to showcase he is critical to the project and might work in their own silo. I feel this is where leaders must step in and create an open environment and set up team goals and individual goals. Goals should be measured against the product and his own performance rather than others. These goals should be made visible to everyone in the team and it creates a transparent environment, meaning they can help themselves and others to achieve goals. They are not competing anymore, and this helps them to build a sense of trust and succeed as a team.”



How to sort list of objects in Java. Sorting Objects in Java


Usually if you want to sort array of integers or string it is quite straight forward like Arrays.sort(myIntArray) or Collections.sort( list ); But say if you want to sort a list/array of objects then its not straight forward.

In this tutorial we would see how to sort a list of objects java. There are two ways of sorting objects in java, by using Comparable or Comparator. Its always confusing for people to use which over the other and why?

Here are my suggestions.

  • If your object is to be sorted only by single attribute then go for comparable. The class that need’s to be sorted should implement comparable and define compareTo(Object arg0) method.
  • If your object is to be sorted on multiple attribute’s then go for comparator which takes two objects to compare against each other.



Example: Consider you have a person class whose attributes are firstName, lastName, age, location.

Syntax: Sorting objects based on string property.

Collections.sort(listOfObjectsToBeSorted, new Comparator<ObjectType>() {
public int compare(Object o1, Object o2) {
return o1.getLocation().compareToIgnoreCase(o2.getLocation()); // Sorting based on Location                                                                                                                                             // which is of string type.

Syntax: Sorting objects based on integer property.

Collections.sort(listOfObjectsToBeSorted, new Comparator<ObjectType>() {
public int compare(Object o1, Object o2) {
return 01.getAge() – o2.getAge(); // Sorting based on age which is integer type.

In the following program we would see how you could sort by each property.

public class Person {

private String firstName;
private String lastName;
private int age;
private String location;

public Person(String firstName, String lastName, int age, String location) {
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
this.location = location;

public String getFirstName() {
return firstName;

public String getLastName() {
return lastName;

public int getAge() {
return age;

public String getLocation() {
return location;

public String toString() {
return “Person [firstName=” + firstName + “, lastName=” + lastName + “, age=” + age + “, location=” + location + “]”;

public static void main(String args[]) {
Person person1 = new Person(“Aaron”, “James”, 24, “San Jose”);
Person person2 = new Person(“Bart”, “Modi”, 34, “San Fransisco”);
Person person3 = new Person(“Cathay”, “Pacific”, 22, “Atlanta”);

List<Person> personsList = new ArrayList<Person>();


//Sort According to First Name.
System.out.println(sortObjects(personsList, “firstName”));

//Sort According to Location.
System.out.println(sortObjects(personsList, “location”));

//Sort According to First Name.
System.out.println(sortObjects(personsList, “age”));


public static List<Person> sortObjects(List<Person> personsList, String sortParameter) {

if (sortParameter.equalsIgnoreCase(“location”)) {

if (personsList != null && personsList.size() > 0)
Collections.sort(personsList, new Comparator<Person>() {
public int compare(Person p1, Person p2) {
return p1.getLocation().compareToIgnoreCase(p2.getLocation());

} else if (sortParameter.equalsIgnoreCase(“firstName”)) {
if (personsList != null && personsList.size() > 0)
Collections.sort(personsList, new Comparator<Person>() {
public int compare(Person p1, Person p2) {
return p1.getFirstName().compareToIgnoreCase(p2.getFirstName());
//Sort by age.
else {

if (personsList != null && personsList.size() > 0)
Collections.sort(personsList, new Comparator<Person>() {
public int compare(Person p1, Person p2) {
return p1.getAge() – p2.getAge();

return personsList;




Common and Silly Mistakes to Avoid while writing Android Apps

Android Manifest File: This file is the heart of the app. This file contains the configuration settings like which file is the main program that is should be executed when you launch the app. Few things to remember

1. If your app is using any one of these features like bluetooth, writing data into a file on sdcard, making any REST calls communications you should give permissions in the android manifest file in your app, in order to access them.

<uses-permission android:name=”android.permission.BLUETOOTH” />
<uses-permission android:name=”android.permission.BLUETOOTH_ADMIN” />
<uses-permission android:name=”android.permission.INTERNET”/>
<uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE”/>

2. If you want to have multiple pages in your app, you usually write different activities, and to navigate from one page to another page you use intents. You should put this activity in the manifest file else you will get an error.

3. Always perform network operations (like making http calls etc) in new thread. Never use main thread to do these operations.

Android 2.2 supports writing network operations on main thread but its not supported from Android 2.3

Trie Data Structure

Today I want to discuss about new data structure called Trie. Its pronounced as Tree or Try.

I came to know about this data structure because of the following requirement.

Want to find If Arraylist contains substring.
Example: Arraylist has {“hello world”, “Mandarine Garden”, “Panda Express”, “Olive Garden”}
Now I want to check if the word “Olive” is in the arraylist atleast substring.

One way of doing it is iterating through the array list , comparing each string with substring method and checking.

This way we can do if the arraylist size is small, but if you have size of 10000 it may not be desirable.
So I figured out that trie data structure is the solution. Where it supports a insert, delete, find prefix etc.

You can find the code samples in my Github (Route Finder) Project.