A colleague of mine found some old code today. He came running into our room and telling everyone to come to his desk to look at some code. Now I know why…

public LandType getLandKod(String term) {
        LandType landtyp = LandType.NONE;
        String substring = term.substring(0, 2);

        switch ("AT DE DK ES FI FR GB IE NL NO IT BE SY SZ".indexOf(substring)) {
            case 0:
                landtyp = LandType.AT;
                return landtyp;
            case 3:
                landtyp = LandType.DE;
                return landtyp;
            case 6:
                landtyp = LandType.DK;
                return landtyp;
            case 9:
                landtyp = LandType.ES;
                return landtyp;
            case 12:
                landtyp = LandType.FI;
                return landtyp;
            case 15:
                landtyp = LandType.FR;
                return landtyp;
            case 18:
                landtyp = LandType.GB;
                return landtyp;
            case 21:
                landtyp = LandType.IE;
                return landtyp;
            case 24:
                landtyp = LandType.NL;
                return landtyp;
            case 27:
                landtyp = LandType.NO;
                return landtyp;
            case 30:
                landtyp = LandType.IT;
                return landtyp;
           case 33:
                landtyp = LandType.BE;
                return landtyp;
            case 36:
                landtyp = LandType.SY;
                return landtyp;
            case 39:
                landtyp = LandType.SZ;
                return landtyp;
            default:
                landtyp = LandType.NONE;
                return landtyp;

        } //end switch
}
Old java.. Just go away

Leave a Reply

Your email address will not be published. Required fields are marked *