TreeMap’s blast

Baby steps of util in the Java framework. This writeup is just a check point what I liked this week using these packages.
Consider the case where you have to build out a fact tree where you will have to sort the students in your class based on their birth dates. Treemap gives a natural way of sorting based on date of birth. I liked the simplicity of the TreeMap.



package commons;

import org.joda.time.DateTime;
import org.joda.time.LocalDate;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

import java.util.Map;
import java.util.TreeMap;

public class TreeMapSample {
    public static void main(String args[]) {

        Kid kids[] = {new Kid("Kid1", DateTime.parse("05/01/05", DateTimeFormat.forPattern("MM/dd/yy")).toLocalDate()),
                new Kid("Kid2", DateTime.parse("01/06/05", DateTimeFormat.forPattern("MM/dd/yy")).toLocalDate()),
                        new Kid("Kid3", DateTime.parse("07/12/12", DateTimeFormat.forPattern("MM/dd/yy")). toLocalDate()) };
        Map sortedMap = new TreeMap();
        for (Kid kid : kids) {
            sortedMap.put(kid.getDob(),kid.getName());
        }
        System.out.println(sortedMap.values());

    }

    static class Kid {
        private String name;
        private LocalDate dob;

        public Kid(String name, LocalDate dob) {
            this.name = name;
            this.dob = dob;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public LocalDate getDob() {
            return dob;
        }

        public void setDob(LocalDate dob) {
            this.dob = dob;
        }
    }
}

Legacy systems and its issues. Equifax headache.

One of the most wretching thing for this year and weekend is Equifax issue. The follow up from the credit agency and its response to know whether you are affected or not is more frustrating. The protection that is offered for identity threat is 1 year. Heck, they already did an announcement almost after 6 weeks, and they can protect their customers only for 1 year. After that one has to pay $17 every month to be protected from this wretched organization. So from the initial reports, looks like they failed to upgrade their open source stack. The naked security explaination seems to be the best possible explaination how the struts framework was exploited.

I think this wrtie up from free code camp was much lighter read and was more informative.