Friday, January 4, 2008

How to iterate hash table in java

PRINTING HASH TABLE
To print all the elements of a hash table is not simple task, here is a sample code to help you in this regard


import java.util.Hashtable;
import java.util.Enumeration;

// create a new Hashtable
Hashtable h = new Hashtable( );


// add some key/value pairs to the Hashtable
h.put( "LA" , "Lahore" );
h.put( "KR" , "Karachi" );
h.put( "MN" , "Multan" );
h.put( "SDK" , "SADIQABAD" );


// enumerate all the contents of the hashtable
Enumeration keys = h.keys();
while ( keys.hasMoreElements() )
{
key = (String)keys.nextElement();
stateName = (String)h.get( key );
System.out.println( key + " " + stateName );
// prints lines of the form LA Lahore
// in effectively random order.
} // end while

Politics

Another political watershed


By Ayesha Siddiqa

THE PPP is back on the road again to fight its political battle. While the steering wheel has been passed on to Benazir Bhutto’s 19-year-old son Bilawal, Asif Zardari will be the actual driver. The decision will not be welcomed by all. The PPP will most certainly be criticised for being a dynastic party.

The foreigners, the educated middle class and the military’s covert propagandists will berate the murdered Bhutto and her party for concentrating power in her family’s hand. After all, progressive and liberal political parties do not do this. But then this is pragmatic politics and about the survival of a party which the evil forces in the country damaged severely by killing its leader.

I just read an offensive letter circulated to most writers by a fictitious character employed to propagate the myth of the military being the only worthwhile institution in the country. I would like to agree with the ghostwriter. In fact I would like to add that the PPP, which was the only remaining civilian institution representing the politics of federalism in Pakistan, has also been killed which leaves ample space for just one institution.

The symbolic significance of another dead body flown to Sindh from Rawalpindi does not bode well for relations amongst the federating units, especially the smaller apropos the one large province. Moreover, the PPP was one of the rare civilian institutions which connected the federating units and held them together. There was truth in the slogan ‘Saray soobon ki zanjeer — Benazir, Benazir” (the link between all provinces — Benazir, Benazir). Now we have just the military. Perhaps we are fated to remain with only one institution.

Is it then a foregone conclusion that the PPP is no more? Many believed even in 1979 that the party would die after Zulfikar Ali Bhutto’s assassination. The appointment of Benazir Bhutto’s son Bilawal is designed to keep the party alive. The educated classes might not understand how important are emotional symbols in Pakistan’s politics. Personal charisma is central to the game of politics. If you can’t excite people then it doesn’t work for you.

Many years ago I remember a personal conversation with Aitzaz Ahsan about playing a more active role in the PPP’s politics and about the possibility of challenging Bhutto’s dominance of the party. His answer was that the PPP worker commonly known as the jiyala only recognises the sacrifices of the Bhutto family or his own. No other person has the personal charisma to take over control of the PPP.

I remember another conversation with an Indian friend about the possibility of Rahul Gandhi, who is deemed intellectually less sharp than other youngsters in the party, taking over the Congress. Despite all what we believe about Indian politics I was informed that it would not take a lot for Rahul Gandhi to lead the party. For the common person it is not how smart you are but whether you have the personal charisma which the Gandhi name carries.

The PPP’s decision is about the politics of personal and familial charisma which its other leaders do not possess. There is no one to fill Benazir’s shoes. It is true that lately Aitzaz has built an impressive image but one wonders if he can carry this beyond the educated to the illiterate crowds and across the ethnic divide. The Bhutto name still works because of Zulfikar Ali Bhutto’s political legacy and personal charisma.

He was the man who for the first time in the country’s history convinced the masses that the world was about them. Furthermore his ability to come down to the level of the people and speak their language and inspire them was something totally new. He was truly the only charismatic leader. Bhutto even surpassed Jinnah who was not personally magnetic but had a charismatic cause.

So one understands Asif Zardari’s decision to appoint Bilawal as the party’s chairman. However, the boy is 19 and deserves political and social grooming to actually play the role he has been assigned. The six years in which he will educate himself, followed by years when he will have to acquaint himself with Pakistan, must be spent reorienting the party and providing it with a charismatic ideology.

The fact is that the PPP faces the major challenge of keeping itself intact. The forces which killed Bhutto will also find an opportunity to exploit the difference of opinion amongst its leaders and between leaders and party workers. After all the PPP no longer has Benazir whose commanding voice could silence difference of opinion and make all decisions appear unanimous. Under the circumstances, the best option is to adopt two approaches. First, the party must become inclusive and recruit leadership for the future. This could include other members of the Bhutto family such as the young Fatima and Zulfikar Ali Bhutto Junior who could be seen sharing his duties during the burial of his aunt.

Second, the party leadership must revive some radicalism in the party ideology. Asif Zardari’s present posture is indeed understandable. His first priority is survival of the party and keeping it relevant nationally. However, he must get rid of the conservatism which had crept into the party. The PPP’s election manifesto, which almost seems to have been developed in the offices of the Asian Development Bank or other multilateral NGOs, is one example of this conservatism.

Surely Mr Zardari realises that the evil forces within Pakistan’s establishment might let him build and enjoy some power, but they will not let the PPP survive unless he can connect with the masses. The politics of pragmatism that every single person will talk to him about or educate young Bilawal in is good but it didn’t help Benazir Bhutto save her own life. The evil elements were not keen to see her party survive.

I remember talking to a prominent PML-Q leader a couple of months before Bhutto’s murder. The gentleman insisted that the era of Bhutto and Nawaz Sharif was over. Perhaps what he didn’t tell me was that they had planned to terminate Bhutto’s era because she was not listening. She was the leader of a popular party and could not be expected to compromise beyond a certain point. This would threaten the new state which the powerful forces of the establishment have built. So it made better sense to get rid of Benazir.

Asif Zardari is a survivor and has learnt the ropes of politics during his years in jail. But this also means that he might instinctively over-concentrate on the game of survival. The party intellectuals will teach him about pragmatism. But being ideologically barren is the least pragmatic thing. He has already filled the board of advisers with conservative members representing the landed-feudal-cum-industrialist. He must bring the more honest and ideologically motivated people on board as Bilawal’s trainers and party advisers.

The Bhutto name is important but it might not necessarily help Bilawal when he returns to Pakistan after six years to start his life as a Pakistani politician. More than the Bhutto-Zardari son, this traumatised country needs a political party which can heal the bleeding wounds. Mr Zardari, let it be the PPP once again.

The writer is an independent analyst and author of the book Military Inc: Inside Pakistan’s Military Economy.

ayesha.ibd@gmail.com

Blog Archive