Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Collections

vp17invp17in Posts: 1Member
I had written a class using Vector, Hashtable, TreeMap with adding
elements first using Vector class and passing the Vector instance to
Hashtable as the value and key being specified in the put() method so
that every unique key will have a group of values. Then I pass the
Hashtable instance to the TreeMap for sorting the keys and written
seperate methods for the values to be sorted.

I am getting the keys and storing them in the Object instance and
comparing that with the key just like this and if it matches I am
calling the corresponding value method to be sorted.

Object o = me.getKey();
if(o=="ATW") { cd.getAtwVectorSort(); }
else if(o=="Java") { cd.getJavaVectorSort(); }
else
cd.getMicrosoftVectorSort();

Now my problem is I can't keep on adding if/else statements if there
are 1000 of elements to be sorted. I am looking for some other way to
solve this problem.


Sign In or Register to comment.