package pr2.collections.woerterbuch; import java.util.Collections; import java.util.HashMap; import java.util.Map; public class Woerterbuch { private static final Map WOERTER; static { Map map = new HashMap(); map.put("gehen", "go"); map.put("schlafen", "sleep"); map.put("tanzen", "dance"); map.put("springen", "jump"); WOERTER = Collections.unmodifiableMap(map); } public static void main(String[] args) { if (args.length == 0) { System.err.println("Bitte mindestens ein Wort angeben!"); System.exit(1); } for (String wort : args) { String uebersetzung = WOERTER.get(wort); if (uebersetzung == null) { uebersetzung = ""; } System.out.printf("%s => %s%n", wort, uebersetzung); } } }