Okay so I have a function that looks like this:

public void createMap(String mapName){
ArrayList<Point> Positions = new ArrayList<Point>();
Positions = Maps.map1;
...
}

where Maps is another class, and map1 is a method in that class that returns an ArrayList of points.
What I want to do is make it so that instead of writing Positions = Maps.map1, I want to dynamically call the methods in Maps based on the value of the string mapName. How would I go abouts doing this?

you can enclose method with with if-else condition or switch case condition(Note:- java 7 supports string in switch case.) and depending on calue call methods

Depends on the methods - do you mean different methods for one map (in which case see IIM's post), or that there are multiple maps each with its own implementation of the same method signature (in which case build a java.util.Map<String, Maps> to hold the name as key and a Maps instance as value then use the Map methods to get the instance by name.

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.