/** * Iterates {@linkplain FastEntrySet#fastForEach(Consumer) quickly}, if * possible, on the {@linkplain Map#entrySet() entry set} of the provided * {@code map}. * * @param map * a map on which we will try to iterate * {@linkplain FastEntrySet#fastForEach(Consumer) quickly}. * @param consumer * the consumer that will be passed to * {@link FastEntrySet#fastForEach(Consumer)}, if possible, or to * {@link Iterable#forEach(Consumer)}. * @since 8.1.0 */ @SuppressWarnings("unchecked") public static <K, V> void fastForEach(Object2ObjectMap<K, V> map, final Consumer<? super Object2ObjectMap.Entry<K, V>> consumer) { final ObjectSet<Object2ObjectMap.Entry<K, V>> entries = map.object2ObjectEntrySet(); if (entries instanceof Object2ObjectMap.FastEntrySet) ((Object2ObjectMap.FastEntrySet<K, V>) entries).fastForEach(consumer); else entries.forEach(consumer); } /**