Skip to content

Instantly share code, notes, and snippets.

@HDBandit
Last active December 11, 2015 21:48
Show Gist options
  • Save HDBandit/6b044a9fbcadf8f10896 to your computer and use it in GitHub Desktop.
Save HDBandit/6b044a9fbcadf8f10896 to your computer and use it in GitHub Desktop.
public class LightCarContainer {
private static HashMap<String,LightCar> lightCars = new HashMap<String, LightCar>();
public static LightCar getLightCar(String engine, String color) {
String key = engine + color;
if (!lightCars.containsKey(key)) {
lightCars.put(key, new LightCar(engine,color));
}
return lightCars.get(key);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment