/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import java.util.Map; class SlowIterTests { static void aBad(Map m) { for (K k : m.keySet()) { System.out.printf("%s -> %s\n", k, m.get(k)); } } static void aOk(Map m) { for (Map.Entry e : m.entrySet()) { System.out.printf("%s -> %s\n", e.getKey(), e.getValue()); } } // Inter-procedural variant of aBad. static void bBad(Map m) { for (K k : m.keySet()) { print(k, m); } } static void print(K k, Map m) { System.out.printf("%s -> %s\n", k, m.get(k)); } }