void (final DependencyContext context, final PrintStream stream) { final List<Pair<K, String>> keys = new ArrayList<>(); forEachEntry((a, b) -> { keys.add(Pair.create(a, debugString(a))); return true; }); keys.sort(Pair.comparingBySecond()); for (final Pair<K, String> a: keys) { final Collection<V> b = get(a.first); stream.print(" Key: "); stream.println(a.second); stream.println(" Values:"); final List<String> list = new LinkedList<>(); for (final V value : b) { if (value instanceof Streamable) { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final PrintStream s = new PrintStream(baos); ((Streamable) value).toStream(context, s); list.add(baos.toString()); } } Collections.sort(list); for (final String l : list) { stream.print(l); } stream.println(" End Of Values"); } }