Hi Folks,
So the problem im having is trying to make some code less clunky. I recieve a list of random codes in the form of an Enumeration. I then retrieve a number of codes i read in from a properties file going from most important at the top to least important at the bottom. I want to read in my enumerations and check them against the properties list and retrieve the highest ranking code.

Any ideas?

How far have you got? Which step is currently blocking your progress?

for (Enumeration codes = application.getCodes() ; codes.hasMoreElements();){
Object object =  codes.nextElement();
			    		
    if (object instanceof SomeObject) {
	SomeObject someObject = (SomeObject)object;
	if (someObject.getCode().equals(propertyCode1) ) {
	     response.setCode(propertyCode1)
	     break;
	}
}
}

This is the code so far. I use this again for each "propertyCode*" as long as the "response" is null.
Im trying to make it more efficeient

Don't try to write all this in one go. Break it down to tiny steps that you can test and fix before moving on. Eg start with a program that that reads the codes and prints them out. Test that until it's working because there's no point trying to use the codes it they haven't been read properly.
ps code tags use <> not []

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.