Java question

Java question

May 15, 2013

We have the following java code:

public class MyObj{  
        public String att1;  642-374

        public Integer att2;  
        public Date att3;  

public Map<MyObj, Integer> test(){  
    Map<MyObj, Integer> map = new HashMap<MyKey, Integer>();  

    List<MyObj> myObjList = service.getMyObjList();  

    for (MyObj obj : myObjList){  
        map.put(obj, obj.att2);  

    return map;  

Java question: Make changes to test() method so the resulting Map is sorted by it keys. The keys must be sorted by their att1 value.

Angel Gruev

IT professional focused on software development having background with software architecture, project management, JAVA, J2EE, Oracle, ADF, BPEL, Integration specialist. Very focused, highly motivated, proactive and quality/detail oriented with strong troubleshooting and problem investigation skills. Passionate about finding new methods for planning and design, project management, training and education.

More Posts - Website

Follow Me:
LinkedInGoogle Plus

Do you want more great blogs like this?

Subscribe for Dreamix Blog now!