Thursday, May 26, 2011

Why in Java ?


I have some doubts regarding Typesafe(Generics) Collection, Arrays with respect to covariance. I post that as a writeup.

What is a covariant ?
Using (Assigning or returning) subclass object where super class object is expected.

In Java
1. Collection (with generics) is not covariant.
2. But Arrays in Java supports this covariant.

ArrayList<Number> objList = new ArrayList<Integer>(); // illegal
Number[] nrArr = new Integer[10]; // legal

Does it mean Generics is designed well and Array is not ?

Here is the sample code for reference.

// Generic Collections

ArrayList<Number> numberList = new ArrayList<Integer>(); // illegal;

or

ArrayList<Integer> integerList = new ArrayList<Integer>();
ArrayList<Number> numberList = integerList; // illegal;

Above assignment will give you compile time error as Type mismatch: cannot convert from ArrayList<Number> to ArrayList<Integer>. This is not allowed for a vaild reason that if it is allowed in future program may add an instance which might break the type-safety of integerList;

numberList.add(new Float(0.0)); // This fades the typesafety of strList

Consequence is same for Arrays. i.e We can assign wrong types to superType reference array which will lead to run time errors. But why is this allowed ?

// Arrays

Number[] nrArr = new Integer[10];
nrArr[0] = new Float(0.0); // Compiles well but at runtime it will fail.

or

Integer[] intArr = new Integer[10];
Number[] nrArr = intArr;
nrArr[0] = new Float(0.0); // Compiles well but at runtime it will fail.


I don't understand why is this allowed in Java. Is this a miss or my misunderstanding ?

Wednesday, February 10, 2010

Go Back India, Go Back!!!

This blog is all about how we were and how are we going.

Go Back India !!!

Political

Leaders searched for followers. Now followers searching for good leaders. Vivekanadha asked for just 10 youngsters to make India great. I am not sure if these words hold good now even with 100 Vivekanandha-s. We didn't have beggar and we were wealthier than any country calling itself great now. All that we lost when we were loosing our morality.

Family

A wonderful family system where people lived with their brothers and sisters even after their marriage. Now even husband and wife couldn’t love and live together. Number of divorce and number of suicides increased a lot. We made ourselves an Iceland. What we earned or learned in terms of Independence and being western. Just make ourselves independent from everything even from happiness. In course of living we proved how not to live. We have to learn at least at this stage and age.

Men and Women are equal

Meaning is misunderstood. Women respected Men and Men respected Woman for each other’s identity. Now there is no respect for own identity. A man started living like woman and woman started few manly activities including smoking and drinking. I don’t say woman shouldn't do whatever a man can do. But why don’t you do something which is good. As an Indian woman you have the respect across the world. It is in every woman’s hands to retain it back and make it alive.

Motherhood is lost somewhere. It is not to be shown only to your children. It can be shown to your friends, elders and everybody crosses you. Theresa became Mother Theresa just by showing motherhood to all. As a man you hold the responsibility of building your society and protect it. In past, men and women shared these among themselves to hold their family good in turn their society. Man and woman equally contributed to the society. But now they don’t hold these responsibilities. They have to be equal by sharing the responsibility and hold accountability for their responsibilities. Since the meaning is misunderstood and in course of proving Men and Women equal we scattered these responsibilities rather merging them. Now the responsibility is on grounds with none to hold.

We had very good yogis now end up with Bogis.

We are chasing Western in their junk habits where western learns the good from India. We learnt bad habits like drinking or smoking. Identify and acknowledge our good things first. We have to analyze what we lost in the course of chasing others.

We had a very good education system in India even before 2000 years and we had all the professionals like Drs, warriors and Great politicians who died for the nation. Those people are kept wealthy where only the wealthy people are allowed to rule now. Where are we going?

Go back India please Go Back to your Nativity!!!

Jai Hind!!!

Friday, November 21, 2008



Posted using ShareThis

Wednesday, July 30, 2008

உன்னில் தொலைத்த என்னை

நெஞ்சை களவு கொண்டு போனவளே
என்னை கலைத்து விட்டு போனவளே

வில்லைக் கண்ணாய் கொண்டவளே
விழி அம்பால் என்னை சாய்த்தவளே

காத்திருந்து
காத்திருந்து கரைகின்றேன்
உன்னை தேடித் தேடித் தொலைகின்றேன்

உன்னில் தெரியாமல் தொலைத்த
என்னை
தெரிந்தே தொலைப்பதற்காக !!!

Friday, June 27, 2008

MISSING YOU



MISSING YOU

Most of us feel / long for something that we do miss. I key down better and faster than I do pen. But when I did pen I used to write dairy every day and go through it in week end. When I am keying I couldn’t write anything; as well no time to turn back to give some thoughts. In life we all have an unspeakable secrets, an irreversible regret, an unreachable dream, an unforgettable Love and un-get-at-able Chilhood. I do have all these. Though all the prior things are sensitive and differ person to person. The later, comes prior in our life, "Childhood" remains almost same for most of the people. At last, I have some time to key in the wistful thing I wish for though I won’t get it back "Childhood". 

 
A small town filled with greenaries and ECO free air as our clean hearted neighbours. Those days of mine doesn’t differ much from my generation. Those who had a TV is big shots, the one who is land lards. We had only two TV in my whole street. I could sign in anybody’s house in that street without giving any prior notice. Today even to goto my relative's house I am supposed to inform them; well in advance to keep their lips smiling. 
 
Every one in that street knew me as it did other way around. Today I don’t know who the buddy is in my next flat as it does the other way around. We own the street we play on the road. No ground, no cricket, no video game, nothing else. All are traditional games, of my town atleast. Kannaamoochi (Lost and found), “Thottu vilayaattu” (Shame!!, Being an S.W Engineer without even knowing the equivalent English name of this game; post me if you know) middle monkey, masa bandhu (Other name is 7 stone). We played hard and studied hardly. Those moments of sharing just a small chocolate with two or three persons tasted delicious and gave lot more happiness than all these buffets in rocking restaurants. 

TV’s were our cheer girls on those days. It was virtue to us. It was complete hangout over week ends. I used to goto my landlord’s house to watch TV. One film per week, 30 min Oliyum Oliyu.m I didn’t even left Vayalum vaalvum. I love to listen to the DD ad. And sound in between ads. I loved TV like anything. Once we watched 3 colored rainbow that is been relayed more than an hour with out even knowing that is the screen that is been displayed when no proper signal is detected. Those days deploying the antenna in a house take their status to new heights. Cricket, watching it completely from first ball till the presentation without even understanding what the game is. I could buy a home theater which would break my neighbor's walls but do I get that happiness, which I got it in a old model TV. TV remains same; more over it got much better and enriched. But I lost something which gave me happiness and making me to enjoy.

I could enjoy everything. Everything was fun on those days though I didn’t understand; and because I didn’t understand. When I know and understand things now, watching Cricket gives me pressure, when our team does in the game. Along with understanding and maturity, I got all these unwanted Tension and long busy days. I want to grow yes I want to grow young. I love and wish to unlearn these all and get back my happiness and fun what I had. 

Miss you “Childhood”.

Thursday, October 11, 2007

Love Hurts!!!


LOVE or LOVER...

Yes it does when you love a wrong mortal... For the mistake of that mortal don't blame, hate or say the immortal love hurts... The most happiest person would fall in either the one who loves or the one who is being loved. The most luckiest person is the one who is being loved by the one whom he loves. No creature other than human being smile. But all faunas love...
Don't interpret that I am against the ones who lost and are hurt by love. Even I lost my love and my only love. I didn't spoil my life for that mortal who betrayed me... The one which saved me and recovered me from that down pits is again love... Don't imagine; it is my parents love. So love is the pain and love is the medicine... So love is not wrong and the wrong thing is loving a wrong person at a wrong time.


When you break your first relationship (I mean it; relationship) with your (may now others) loved one you must had shed out drops to shake off from that mind-bending shake. But a herd, even me, yelled , as much as love(...)d, at the loved one(s) without even ask for the reason for break. Hold your emotions for a while though it is tough, but not impossible. Don't face her/him. Don't try to convince but try to get the reason at least. Better option than us would really hurt us , but don't worry you will get the best.

With Love,

~ Shan

Wednesday, October 10, 2007

Stock monkeys

The Stock Market simply illustrated .... Here is a lesson for those gritty minds...

Once upon a time in a village, a man appeared and announced to the villagers that he would buy monkeys for Rs10.The villagers seeing that there were many monkeys around, went out to the forest and started catching them.The man bought thousands at Rs10 and as supply started to diminish, the villagers stopped their effort. He further announced that he would now buy at Rs20. This renewed the efforts of the villagers and they started catching monkeys again.Soon the supply diminished even further and people started going back to their farms. The offer rate increased to Rs25 and the supply of monkeys became so little that it was an effort to even see a monkey, let alone catch it!The man now announced that he would buy monkeys at Rs50! However, since he had to go to the city on some business, his assistant would now buy on behalf of him.In the absence of the man, the assistant told the villagers. Look at all these monkeys in the big cage that the man has collected. I will sell them to you at Rs35 and when the man returns from the city, you can sell it to him for Rs50."The villagers squeezed up with all their savings and bought all the monkeys.Then they never saw the man nor his assistant, only monkeys everywhere!!!

Welcome to the "Stock" Market!!!!! :-)