    public static void main(final String[] args) throws Exception {
        final String ALL_ASYNC = "-DLog4jContextSelector="
                + AsyncLoggerContextSelector.class.getName();
        final String CACHEDCLOCK = "-Dlog4j.Clock=CachedClock";
        final String SYSCLOCK = "-Dlog4j.Clock=SystemClock";
        final String LOG12 = RunLog4j1.class.getName();
        final String LOG20 = RunLog4j2.class.getName();
        final String LOGBK = RunLogback.class.getName();

        final String THREADNAME = "-DAsyncLogger.ThreadNameStrategy=" //
                + System.getProperty("AsyncLogger.ThreadNameStrategy", "CACHED");

        final long start = System.nanoTime();
        final List<Setup> tests = new ArrayList<>();
        // includeLocation=false
        tests.add(s("perf3PlainNoLoc.xml", LOG20, "Loggers all async",
                ALL_ASYNC, SYSCLOCK, THREADNAME));
        tests.add(s("perf7MixedNoLoc.xml", LOG20, "Loggers mixed sync/async"));
        tests.add(s("perf-logback.xml", LOGBK, "Sync"));
        tests.add(s("perf-log4j12.xml", LOG12, "Sync"));
        tests.add(s("perf3PlainNoLoc.xml", LOG20, "Sync"));
        tests.add(s("perf-logback-async.xml", LOGBK, "Async Appender"));
        tests.add(s("perf-log4j12-async.xml", LOG12, "Async Appender"));
        tests.add(s("perf5AsyncApndNoLoc.xml", LOG20, "Async Appender"));

        // includeLocation=true
        // tests.add(s("perf6AsyncApndLoc.xml", LOG20,
        // "Async Appender includeLocation"));
        // tests.add(s("perf8MixedLoc.xml", LOG20,
        // "Mixed sync/async includeLocation"));
        // tests.add(s("perf4PlainLocation.xml", LOG20,
        // "Loggers all async includeLocation", ALL_ASYNC));
        // tests.add(s("perf4PlainLocation.xml", LOG20,
        // "Loggers all async includeLocation CachedClock", ALL_ASYNC,
        // CACHEDCLOCK));
        // tests.add(s("perf4PlainLocation.xml", LOG20,
        // "Sync includeLocation"));

        // appenders
        // tests.add(s("perf1syncFile.xml", LOG20, "FileAppender"));
        // tests.add(s("perf1syncRandomAccessFile.xml", LOG20, "RandomAccessFileAppender"));
        // tests.add(s("perf2syncRollFile.xml", LOG20, "RollFileAppender"));
        // tests.add(s("perf2syncRollRandomAccessFile.xml", LOG20,
        // "RollRandomAccessFileAppender"));

        final int MAX_THREADS = 4; // 64 takes a LONG time
        for (int i = 2; i <= MAX_THREADS; i *= 2) {
            // includeLocation = false
            tests.add(m("perf-logback.xml", LOGBK, "Sync", i));
            tests.add(m("perf-log4j12.xml", LOG12, "Sync", i));
            tests.add(m("perf3PlainNoLoc.xml", LOG20, "Sync", i));
            tests.add(m("perf-logback-async.xml", LOGBK, "Async Appender", i));
            tests.add(m("perf-log4j12-async.xml", LOG12, "Async Appender", i));
            tests.add(m("perf5AsyncApndNoLoc.xml", LOG20, "Async Appender", i));
            tests.add(m("perf3PlainNoLoc.xml", LOG20, "Loggers all async", i,
                    ALL_ASYNC, SYSCLOCK, THREADNAME));
            tests.add(m("perf7MixedNoLoc.xml", LOG20,
                    "Loggers mixed sync/async", i));

            // includeLocation=true
            // tests.add(m("perf6AsyncApndLoc.xml", LOG20,
            // "Async Appender includeLocation", i));
            // tests.add(m("perf8MixedLoc.xml", LOG20,
            // "Mixed sync/async includeLocation", i));
            // tests.add(m("perf4PlainLocation.xml", LOG20,
            // "Loggers all async includeLocation", i, ALL_ASYNC));
            // tests.add(m("perf4PlainLocation.xml", LOG20,
            // "Loggers all async includeLocation CachedClock", i,
            // ALL_ASYNC, CACHEDCLOCK));
            // tests.add(m("perf4PlainLocation.xml", LOG20,
            // "Sync includeLocation", i));

            // appenders
            // tests.add(m("perf1syncFile.xml", LOG20, "FileAppender", i));
            // tests.add(m("perf1syncRandomAccessFile.xml", LOG20, "RandomAccessFileAppender",
            // i));
            // tests.add(m("perf2syncRollFile.xml", LOG20, "RollFileAppender",
            // i));
            // tests.add(m("perf2syncRollRandomAccessFile.xml", LOG20,
            // "RollRandomAccessFileAppender", i));
        }

        final String java = args.length > 0 ? args[0] : "java";
        final int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
        int x = 0;
        for (final Setup config : tests) {
            System.out.print(config.description());
            final ProcessBuilder pb = config.throughputTest(java);
            pb.redirectErrorStream(true); // merge System.out and System.err
            final long t1 = System.nanoTime();
            final int count = config.threadCount >= 4 ? 3 : repeat;
            runPerfTest(count, x++, config, pb);
            System.out.printf(" took %.1f seconds%n", (System.nanoTime() - t1)
                    / (1000.0 * 1000.0 * 1000.0));

            final FileReader reader = new FileReader(config.temp);
            final CharBuffer buffer = CharBuffer.allocate(256 * 1024);
            reader.read(buffer);
            reader.close();
            config.temp.delete();
            buffer.flip();

            final String raw = buffer.toString();
            System.out.print(raw);
            final Stats stats = new Stats(raw);
            System.out.println(stats);
            System.out.println("-----");
            config.stats = stats;
        }
        new File("perftest.log").delete();
        System.out
                .printf("Done. Total duration: %.1f minutes%n",
                        (System.nanoTime() - start)
                                / (60.0 * 1000.0 * 1000.0 * 1000.0));

        printRanking(tests.toArray(new Setup[tests.size()]));
    }

    public static void main(final String[] args) throws Exception {
        final String ALL_ASYNC = "-DLog4jContextSelector="
                + AsyncLoggerContextSelector.class.getName();
        final String CACHEDCLOCK = "-Dlog4j.Clock=CachedClock";
        final String SYSCLOCK = "-Dlog4j.Clock=SystemClock";
        final String LOG12 = RunLog4j1.class.getName();
        final String LOG20 = RunLog4j2.class.getName();
        final String LOGBK = RunLogback.class.getName();

        final String THREADNAME = "-DAsyncLogger.ThreadNameStrategy=" //
                + System.getProperty("AsyncLogger.ThreadNameStrategy", "CACHED");

        final long start = System.nanoTime();
        final List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
        // includeLocation=false
        tests.add(s("perf3PlainNoLoc.xml", LOG20, "Loggers all async",
                ALL_ASYNC, SYSCLOCK, THREADNAME));
        tests.add(s("perf7MixedNoLoc.xml", LOG20, "Loggers mixed sync/async"));
        tests.add(s("perf-logback.xml", LOGBK, "Sync"));
        tests.add(s("perf-log4j12.xml", LOG12, "Sync"));
        tests.add(s("perf3PlainNoLoc.xml", LOG20, "Sync"));
        tests.add(s("perf-logback-async.xml", LOGBK, "Async Appender"));
        tests.add(s("perf-log4j12-async.xml", LOG12, "Async Appender"));
        tests.add(s("perf5AsyncApndNoLoc.xml", LOG20, "Async Appender"));

        // includeLocation=true
        // tests.add(s("perf6AsyncApndLoc.xml", LOG20,
        // "Async Appender includeLocation"));
        // tests.add(s("perf8MixedLoc.xml", LOG20,
        // "Mixed sync/async includeLocation"));
        // tests.add(s("perf4PlainLocation.xml", LOG20,
        // "Loggers all async includeLocation", ALL_ASYNC));
        // tests.add(s("perf4PlainLocation.xml", LOG20,
        // "Loggers all async includeLocation CachedClock", ALL_ASYNC,
        // CACHEDCLOCK));
        // tests.add(s("perf4PlainLocation.xml", LOG20,
        // "Sync includeLocation"));

        // appenders
        // tests.add(s("perf1syncFile.xml", LOG20, "FileAppender"));
        // tests.add(s("perf1syncRandomAccessFile.xml", LOG20, "RandomAccessFileAppender"));
        // tests.add(s("perf2syncRollFile.xml", LOG20, "RollFileAppender"));
        // tests.add(s("perf2syncRollRandomAccessFile.xml", LOG20,
        // "RollRandomAccessFileAppender"));

        final int MAX_THREADS = 4; // 64 takes a LONG time
        for (int i = 2; i <= MAX_THREADS; i *= 2) {
            // includeLocation = false
            tests.add(m("perf-logback.xml", LOGBK, "Sync", i));
            tests.add(m("perf-log4j12.xml", LOG12, "Sync", i));
            tests.add(m("perf3PlainNoLoc.xml", LOG20, "Sync", i));
            tests.add(m("perf-logback-async.xml", LOGBK, "Async Appender", i));
            tests.add(m("perf-log4j12-async.xml", LOG12, "Async Appender", i));
            tests.add(m("perf5AsyncApndNoLoc.xml", LOG20, "Async Appender", i));
            tests.add(m("perf3PlainNoLoc.xml", LOG20, "Loggers all async", i,
                    ALL_ASYNC, SYSCLOCK, THREADNAME));
            tests.add(m("perf7MixedNoLoc.xml", LOG20,
                    "Loggers mixed sync/async", i));

            // includeLocation=true
            // tests.add(m("perf6AsyncApndLoc.xml", LOG20,
            // "Async Appender includeLocation", i));
            // tests.add(m("perf8MixedLoc.xml", LOG20,
            // "Mixed sync/async includeLocation", i));
            // tests.add(m("perf4PlainLocation.xml", LOG20,
            // "Loggers all async includeLocation", i, ALL_ASYNC));
            // tests.add(m("perf4PlainLocation.xml", LOG20,
            // "Loggers all async includeLocation CachedClock", i,
            // ALL_ASYNC, CACHEDCLOCK));
            // tests.add(m("perf4PlainLocation.xml", LOG20,
            // "Sync includeLocation", i));

            // appenders
            // tests.add(m("perf1syncFile.xml", LOG20, "FileAppender", i));
            // tests.add(m("perf1syncRandomAccessFile.xml", LOG20, "RandomAccessFileAppender",
            // i));
            // tests.add(m("perf2syncRollFile.xml", LOG20, "RollFileAppender",
            // i));
            // tests.add(m("perf2syncRollRandomAccessFile.xml", LOG20,
            // "RollRandomAccessFileAppender", i));
        }

        final String java = args.length > 0 ? args[0] : "java";
        final int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
        int x = 0;
        for (final Setup config : tests) {
            System.out.print(config.description());
            final ProcessBuilder pb = config.throughputTest(java);
            pb.redirectErrorStream(true); // merge System.out and System.err
            final long t1 = System.nanoTime();
            final int count = config.threadCount >= 4 ? 3 : repeat;
            runPerfTest(count, x++, config, pb);
            System.out.printf(" took %.1f seconds%n", (System.nanoTime() - t1)
                    / (1000.0 * 1000.0 * 1000.0));

            final FileReader reader = new FileReader(config.temp);
            final CharBuffer buffer = CharBuffer.allocate(256 * 1024);
            reader.read(buffer);
            reader.close();
            config.temp.delete();
            buffer.flip();

            final String raw = buffer.toString();
            System.out.print(raw);
            final Stats stats = new Stats(raw);
            System.out.println(stats);
            System.out.println("-----");
            config.stats = stats;
        }
        new File("perftest.log").delete();
        System.out
                .printf("Done. Total duration: %.1f minutes%n",
                        (System.nanoTime() - start)
                                / (60.0 * 1000.0 * 1000.0 * 1000.0));

        printRanking(tests.toArray(new Setup[tests.size()]));
    }

Replace Generic With Diamond ArrayList<PerfTestDriver.Setup> with ArrayList<> in method public main(args String[]) : void from class org.apache.logging.log4j.core.async.perftest.PerfTestDriver


    private void process(final String line) throws ParseException {
        final String key = line.substring(line.indexOf('.') + 1, line.indexOf('('));
        final String sub = line.substring(line.indexOf('(') + 1, line.indexOf(')'));
        final String throughput = line.substring(line.indexOf("throughput: ")
                + "throughput: ".length(), line.indexOf(" ops"));
        final String avg = line.substring(line.indexOf("avg=") + "avg=".length(),
                line.indexOf(" 99%"));
        final String pct99 = line.substring(
                line.indexOf("99% < ") + "99% < ".length(),
                line.indexOf(" 99.99%"));
        final String pct99_99 = line.substring(line.indexOf("99.99% < ")
                + "99.99% < ".length(), line.lastIndexOf('(') - 1);
        final Stats stats = new Stats(throughput, avg, pct99, pct99_99);
        Map<String, Stats> map = results.get(key.trim());
        if (map == null) {
            map = new TreeMap<>(sort());
            results.put(key.trim(), map);
        }
        String subKey = sub.trim();
        if ("single thread".equals(subKey)) {
            subKey = "1 thread";
        }
        map.put(subKey, stats);
    }

    private void process(final String line) throws ParseException {
        final String key = line.substring(line.indexOf('.') + 1, line.indexOf('('));
        final String sub = line.substring(line.indexOf('(') + 1, line.indexOf(')'));
        final String throughput = line.substring(line.indexOf("throughput: ")
                + "throughput: ".length(), line.indexOf(" ops"));
        final String avg = line.substring(line.indexOf("avg=") + "avg=".length(),
                line.indexOf(" 99%"));
        final String pct99 = line.substring(
                line.indexOf("99% < ") + "99% < ".length(),
                line.indexOf(" 99.99%"));
        final String pct99_99 = line.substring(line.indexOf("99.99% < ")
                + "99.99% < ".length(), line.lastIndexOf('(') - 1);
        final Stats stats = new Stats(throughput, avg, pct99, pct99_99);
        Map<String, Stats> map = results.get(key.trim());
        if (map == null) {
            map = new TreeMap<String, Stats>(sort());
            results.put(key.trim(), map);
        }
        String subKey = sub.trim();
        if ("single thread".equals(subKey)) {
            subKey = "1 thread";
        }
        map.put(subKey, stats);
    }

Replace Generic With Diamond TreeMap<String,Stats> with TreeMap<> in method private process(line String) : void from class org.apache.logging.log4j.core.async.perftest.PerfTestResultFormatter


    public static Map<Object, Map<String, String>> getAdvertisedEntries()
    {
        final Map<Object, Map<String, String>> result = new HashMap<>();
        result.putAll(properties);
        return result;
    }

    public static Map<Object, Map<String, String>> getAdvertisedEntries()
    {
        final Map<Object, Map<String, String>> result = new HashMap<Object, Map<String, String>>();
        result.putAll(properties);
        return result;
    }

Replace Generic With Diamond HashMap<Object,Map<String,String>> with HashMap<> in method public getAdvertisedEntries() : Map<Object,Map<String,String>> from class org.apache.logging.log4j.core.config.InMemoryAdvertiser


    @Override
    public Object advertise(final Map<String, String> newEntry) {
        final Object object = new Object();
        properties.put(object, new HashMap<>(newEntry));
        return object;
    }

    @Override
    public Object advertise(final Map<String, String> newEntry) {
        final Object object = new Object();
        properties.put(object, new HashMap<String, String>(newEntry));
        return object;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public advertise(newEntry Map<String,String>) : Object from class org.apache.logging.log4j.core.config.InMemoryAdvertiser


    @Test
    public void testConfig() {
        final LoggerContext ctx = Configurator.initialize("Test1", "target/test-classes/log4j2-mapfilter.xml");
        final Configuration config = ctx.getConfiguration();
        final Filter filter = config.getFilter();
        assertNotNull("No MapFilter", filter);
        assertTrue("Not a MapFilter", filter instanceof  MapFilter);
        final MapFilter mapFilter = (MapFilter) filter;
        assertFalse("Should not be And filter", mapFilter.isAnd());
        final Map<String, List<String>> map = mapFilter.getMap();
        assertNotNull("No Map", map);
        assertFalse("No elements in Map", map.isEmpty());
        assertEquals("Incorrect number of elements in Map", 1, map.size());
        assertTrue("Map does not contain key eventId", map.containsKey("eventId"));
        assertEquals("List does not contain 2 elements", 2, map.get("eventId").size());
        final Logger logger = LogManager.getLogger(MapFilterTest.class);
        final Map<String, String> eventMap = new HashMap<>();
        eventMap.put("eventId", "Login");
        logger.debug(new MapMessage(eventMap));
        final Appender app = config.getAppender("LIST");
        assertNotNull("No List appender", app);
        final List<String> msgs = ((ListAppender) app).getMessages();
        assertNotNull("No messages", msgs);
        assertFalse("No messages", msgs.isEmpty());

    }

    @Test
    public void testConfig() {
        final LoggerContext ctx = Configurator.initialize("Test1", "target/test-classes/log4j2-mapfilter.xml");
        final Configuration config = ctx.getConfiguration();
        final Filter filter = config.getFilter();
        assertNotNull("No MapFilter", filter);
        assertTrue("Not a MapFilter", filter instanceof  MapFilter);
        final MapFilter mapFilter = (MapFilter) filter;
        assertFalse("Should not be And filter", mapFilter.isAnd());
        final Map<String, List<String>> map = mapFilter.getMap();
        assertNotNull("No Map", map);
        assertFalse("No elements in Map", map.isEmpty());
        assertEquals("Incorrect number of elements in Map", 1, map.size());
        assertTrue("Map does not contain key eventId", map.containsKey("eventId"));
        assertEquals("List does not contain 2 elements", 2, map.get("eventId").size());
        final Logger logger = LogManager.getLogger(MapFilterTest.class);
        final Map<String, String> eventMap = new HashMap<String, String>();
        eventMap.put("eventId", "Login");
        logger.debug(new MapMessage(eventMap));
        final Appender app = config.getAppender("LIST");
        assertNotNull("No List appender", app);
        final List<String> msgs = ((ListAppender) app).getMessages();
        assertNotNull("No messages", msgs);
        assertFalse("No messages", msgs.isEmpty());

    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public testConfig() : void from class org.apache.logging.log4j.core.filter.MapFilterTest


    /**
     * @return a log event that uses all the bells and whistles, features, nooks and crannies
     */
    static Log4jLogEvent createLogEvent() {
        final Marker cMarker = MarkerManager.getMarker("Marker1");
        final Marker pMarker1 = MarkerManager.getMarker("ParentMarker1");
        final Marker pMarker2 = MarkerManager.getMarker("ParentMarker2");
        final Marker gfMarker = MarkerManager.getMarker("GrandFatherMarker");
        final Marker gmMarker = MarkerManager.getMarker("GrandMotherMarker");
        cMarker.addParents(pMarker1);
        cMarker.addParents(pMarker2);
        pMarker1.addParents(gmMarker);
        pMarker1.addParents(gfMarker);
        final Exception sourceHelper = new Exception();
        sourceHelper.fillInStackTrace();
        final Exception cause = new NullPointerException("testNPEx");
        sourceHelper.fillInStackTrace();
        final StackTraceElement source = sourceHelper.getStackTrace()[0];
        final IOException ioException = new IOException("testIOEx", cause);
        Throwables.addSuppressed(ioException, new IndexOutOfBoundsException("I am suppressed exception 1"));
        Throwables.addSuppressed(ioException, new IndexOutOfBoundsException("I am suppressed exception 2"));
        final ThrowableProxy throwableProxy = new ThrowableProxy(ioException);
        final Map<String, String> contextMap = new HashMap<>();
        contextMap.put("MDC.A", "A_Value");
        contextMap.put("MDC.B", "B_Value");
        final DefaultThreadContextStack contextStack = new DefaultThreadContextStack(true);
        contextStack.clear();
        contextStack.push("stack_msg1");
        contextStack.add("stack_msg2");
        final Log4jLogEvent expected = Log4jLogEvent.createEvent("a.B", cMarker, "f.q.c.n", Level.DEBUG,
                new SimpleMessage("Msg"), ioException, throwableProxy, contextMap, contextStack, "MyThreadName", source,
                1);
        // validate event?
        return expected;
    }

    /**
     * @return a log event that uses all the bells and whistles, features, nooks and crannies
     */
    static Log4jLogEvent createLogEvent() {
        final Marker cMarker = MarkerManager.getMarker("Marker1");
        final Marker pMarker1 = MarkerManager.getMarker("ParentMarker1");
        final Marker pMarker2 = MarkerManager.getMarker("ParentMarker2");
        final Marker gfMarker = MarkerManager.getMarker("GrandFatherMarker");
        final Marker gmMarker = MarkerManager.getMarker("GrandMotherMarker");
        cMarker.addParents(pMarker1);
        cMarker.addParents(pMarker2);
        pMarker1.addParents(gmMarker);
        pMarker1.addParents(gfMarker);
        final Exception sourceHelper = new Exception();
        sourceHelper.fillInStackTrace();
        final Exception cause = new NullPointerException("testNPEx");
        sourceHelper.fillInStackTrace();
        final StackTraceElement source = sourceHelper.getStackTrace()[0];
        final IOException ioException = new IOException("testIOEx", cause);
        Throwables.addSuppressed(ioException, new IndexOutOfBoundsException("I am suppressed exception 1"));
        Throwables.addSuppressed(ioException, new IndexOutOfBoundsException("I am suppressed exception 2"));
        final ThrowableProxy throwableProxy = new ThrowableProxy(ioException);
        final Map<String, String> contextMap = new HashMap<String, String>();
        contextMap.put("MDC.A", "A_Value");
        contextMap.put("MDC.B", "B_Value");
        final DefaultThreadContextStack contextStack = new DefaultThreadContextStack(true);
        contextStack.clear();
        contextStack.push("stack_msg1");
        contextStack.add("stack_msg2");
        final Log4jLogEvent expected = Log4jLogEvent.createEvent("a.B", cMarker, "f.q.c.n", Level.DEBUG,
                new SimpleMessage("Msg"), ioException, throwableProxy, contextMap, contextStack, "MyThreadName", source,
                1);
        // validate event?
        return expected;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method package createLogEvent() : Log4jLogEvent from class org.apache.logging.log4j.core.layout.LogEventFixtures


    @Test
    public void testLookup() {
        final Map<String, String> map = new HashMap<>();
        map.put(TESTKEY, TESTVAL);
        final StrLookup lookup = new Interpolator(new MapLookup(map));
        ThreadContext.put(TESTKEY, TESTVAL);
        String value = lookup.lookup(TESTKEY);
        assertEquals(TESTVAL, value);
        value = lookup.lookup("ctx:" + TESTKEY);
        assertEquals(TESTVAL, value);
        value = lookup.lookup("sys:" + TESTKEY);
        assertEquals(TESTVAL, value);
        value = lookup.lookup("BadKey");
        assertNull(value);
        ThreadContext.clearMap();
        value = lookup.lookup("ctx:" + TESTKEY);
        assertEquals(TESTVAL, value);
        value = lookup.lookup("jndi:" + TEST_CONTEXT_RESOURCE_NAME);
        assertEquals(TEST_CONTEXT_NAME, value);
    }

    @Test
    public void testLookup() {
        final Map<String, String> map = new HashMap<String, String>();
        map.put(TESTKEY, TESTVAL);
        final StrLookup lookup = new Interpolator(new MapLookup(map));
        ThreadContext.put(TESTKEY, TESTVAL);
        String value = lookup.lookup(TESTKEY);
        assertEquals(TESTVAL, value);
        value = lookup.lookup("ctx:" + TESTKEY);
        assertEquals(TESTVAL, value);
        value = lookup.lookup("sys:" + TESTKEY);
        assertEquals(TESTVAL, value);
        value = lookup.lookup("BadKey");
        assertNull(value);
        ThreadContext.clearMap();
        value = lookup.lookup("ctx:" + TESTKEY);
        assertEquals(TESTVAL, value);
        value = lookup.lookup("jndi:" + TEST_CONTEXT_RESOURCE_NAME);
        assertEquals(TEST_CONTEXT_NAME, value);
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public testLookup() : void from class org.apache.logging.log4j.core.lookup.InterpolatorTest


    @Test
    public void testMap() {
        final HashMap<String, String> map = new HashMap<>();
        map.put("A", "B");
        final MapLookup lookup = new MapLookup(map);
        assertEquals(null, lookup.lookup(null));
        assertEquals("B", lookup.lookup("A"));
    }

    @Test
    public void testMap() {
        final HashMap<String, String> map = new HashMap<String, String>();
        map.put("A", "B");
        final MapLookup lookup = new MapLookup(map);
        assertEquals(null, lookup.lookup(null));
        assertEquals("B", lookup.lookup("A"));
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public testMap() : void from class org.apache.logging.log4j.core.lookup.MapLookupTest


    @Test
    public void testLookup() {
        final Map<String, String> map = new HashMap<>();
        map.put(TESTKEY, TESTVAL);
        final StrLookup lookup = new Interpolator(new MapLookup(map));
        final StrSubstitutor subst = new StrSubstitutor(lookup);
        ThreadContext.put(TESTKEY, TESTVAL);
        String value = subst.replace("${TestKey}-${ctx:TestKey}-${sys:TestKey}");
        assertEquals("TestValue-TestValue-TestValue", value);
        value = subst.replace("${BadKey}");
        assertEquals("${BadKey}", value);

        value = subst.replace("${BadKey:-Unknown}-${ctx:BadKey:-Unknown}-${sys:BadKey:-Unknown}");
        assertEquals("Unknown-Unknown-Unknown", value);
        value = subst.replace("${BadKey:-Unknown}-${ctx:BadKey}-${sys:BadKey:-Unknown}");
        assertEquals("Unknown-${ctx:BadKey}-Unknown", value);
        value = subst.replace("${BadKey:-Unknown}-${ctx:BadKey:-}-${sys:BadKey:-Unknown}");
        assertEquals("Unknown--Unknown", value);
    }

    @Test
    public void testLookup() {
        final Map<String, String> map = new HashMap<String, String>();
        map.put(TESTKEY, TESTVAL);
        final StrLookup lookup = new Interpolator(new MapLookup(map));
        final StrSubstitutor subst = new StrSubstitutor(lookup);
        ThreadContext.put(TESTKEY, TESTVAL);
        String value = subst.replace("${TestKey}-${ctx:TestKey}-${sys:TestKey}");
        assertEquals("TestValue-TestValue-TestValue", value);
        value = subst.replace("${BadKey}");
        assertEquals("${BadKey}", value);

        value = subst.replace("${BadKey:-Unknown}-${ctx:BadKey:-Unknown}-${sys:BadKey:-Unknown}");
        assertEquals("Unknown-Unknown-Unknown", value);
        value = subst.replace("${BadKey:-Unknown}-${ctx:BadKey}-${sys:BadKey:-Unknown}");
        assertEquals("Unknown-${ctx:BadKey}-Unknown", value);
        value = subst.replace("${BadKey:-Unknown}-${ctx:BadKey:-}-${sys:BadKey:-Unknown}");
        assertEquals("Unknown--Unknown", value);
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public testLookup() : void from class org.apache.logging.log4j.core.lookup.StrSubstitutorTest


    @Test
    public void testReconnect() throws Exception {

        final List<String> list = new ArrayList<>();
        TestSocketServer server = new TestSocketServer(list);
        server.start();
        Thread.sleep(300);

        //System.err.println("Initializing logger");
        final Logger logger = context.getLogger();

        String message = "Log #1";
        logger.error(message);
        final String expectedHeader = "Header";

        String msg = null;
        String header = null;
        for (int i = 0; i < 5; ++i) {
            Thread.sleep(100);
            if (list.size() > 1) {
                header = list.get(0);
                msg = list.get(1);
                break;
            }
        }
        assertNotNull("No header", header);
        assertEquals(expectedHeader, header);
        assertNotNull("No message", msg);
        assertEquals(message, msg);

        logger.error(SHUTDOWN);
        server.join();

        list.clear();

        message = "Log #2";
        boolean exceptionCaught = false;

        for (int i = 0; i < 100; ++i) {
            try {
                logger.error(message);
            } catch (final AppenderLoggingException e) {
                exceptionCaught = true;
                break;
                // System.err.println("Caught expected exception");
            }
        }
        assertTrue("No Exception thrown", exceptionCaught);
        message = "Log #3";

        server = new TestSocketServer(list);
        server.start();
        Thread.sleep(300);

        msg = null;
        header = null;
        logger.error(message);
        for (int i = 0; i < 5; ++i) {
            Thread.sleep(100);
            if (list.size() > 1) {
                header = list.get(0);
                msg = list.get(1);
                break;
            }
        }
        assertNotNull("No header", header);
        assertEquals(expectedHeader, header);
        assertNotNull("No message", msg);
        assertEquals(message, msg);
        logger.error(SHUTDOWN);
        server.join();
    }

    @Test
    public void testReconnect() throws Exception {

        final List<String> list = new ArrayList<String>();
        TestSocketServer server = new TestSocketServer(list);
        server.start();
        Thread.sleep(300);

        //System.err.println("Initializing logger");
        final Logger logger = context.getLogger();

        String message = "Log #1";
        logger.error(message);
        final String expectedHeader = "Header";

        String msg = null;
        String header = null;
        for (int i = 0; i < 5; ++i) {
            Thread.sleep(100);
            if (list.size() > 1) {
                header = list.get(0);
                msg = list.get(1);
                break;
            }
        }
        assertNotNull("No header", header);
        assertEquals(expectedHeader, header);
        assertNotNull("No message", msg);
        assertEquals(message, msg);

        logger.error(SHUTDOWN);
        server.join();

        list.clear();

        message = "Log #2";
        boolean exceptionCaught = false;

        for (int i = 0; i < 100; ++i) {
            try {
                logger.error(message);
            } catch (final AppenderLoggingException e) {
                exceptionCaught = true;
                break;
                // System.err.println("Caught expected exception");
            }
        }
        assertTrue("No Exception thrown", exceptionCaught);
        message = "Log #3";

        server = new TestSocketServer(list);
        server.start();
        Thread.sleep(300);

        msg = null;
        header = null;
        logger.error(message);
        for (int i = 0; i < 5; ++i) {
            Thread.sleep(100);
            if (list.size() > 1) {
                header = list.get(0);
                msg = list.get(1);
                break;
            }
        }
        assertNotNull("No header", header);
        assertEquals(expectedHeader, header);
        assertNotNull("No message", msg);
        assertEquals(message, msg);
        logger.error(SHUTDOWN);
        server.join();
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public testReconnect() : void from class org.apache.logging.log4j.core.net.SocketReconnectTest


    public MockSyslogServer(final int numberOfMessagesToReceive, final int port) {
        this.numberOfMessagesToReceive = numberOfMessagesToReceive;
        this.messageList = new ArrayList<>();
        this.port = port;
    }

    public MockSyslogServer(final int numberOfMessagesToReceive, final int port) {
        this.numberOfMessagesToReceive = numberOfMessagesToReceive;
        this.messageList = new ArrayList<String>();
        this.port = port;
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public MockSyslogServer(numberOfMessagesToReceive int, port int) from class org.apache.logging.log4j.core.net.mock.MockSyslogServer


    @BeforeClass
    public static void setupClass() throws Exception {
        ((LoggerContext) LogManager.getContext(false)).reconfigure();
        initServerSocketFactory();
        // Use a large buffer just to test the code, the UDP test uses a tiny buffer
        server = new SecureTcpSocketServer<>(PORT_NUM, new XmlInputStreamLogEventBridge(1024 * 100,
                Charset.defaultCharset()), sslConfig);
        thread = server.startNewThread();
    }

    @BeforeClass
    public static void setupClass() throws Exception {
        ((LoggerContext) LogManager.getContext(false)).reconfigure();
        initServerSocketFactory();
        // Use a large buffer just to test the code, the UDP test uses a tiny buffer
        server = new SecureTcpSocketServer<InputStream>(PORT_NUM, new XmlInputStreamLogEventBridge(1024 * 100,
                Charset.defaultCharset()), sslConfig);
        thread = server.startNewThread();
    }

Replace Generic With Diamond SecureTcpSocketServer<InputStream> with SecureTcpSocketServer<> in method public setupClass() : void from class org.apache.logging.log4j.core.net.server.SslXmlSocketServerTest


    @BeforeClass
    public static void setupClass() throws Exception {
        ((LoggerContext) LogManager.getContext(false)).reconfigure();
        // Use a large buffer just to test the code, the UDP test uses a tiny buffer
        server = new TcpSocketServer<>(PORT_NUM, new XmlInputStreamLogEventBridge(1024 * 100,
                Charset.defaultCharset()));
        thread = server.startNewThread();
    }

    @BeforeClass
    public static void setupClass() throws Exception {
        ((LoggerContext) LogManager.getContext(false)).reconfigure();
        // Use a large buffer just to test the code, the UDP test uses a tiny buffer
        server = new TcpSocketServer<InputStream>(PORT_NUM, new XmlInputStreamLogEventBridge(1024 * 100,
                Charset.defaultCharset()));
        thread = server.startNewThread();
    }

Replace Generic With Diamond TcpSocketServer<InputStream> with TcpSocketServer<> in method public setupClass() : void from class org.apache.logging.log4j.core.net.server.TcpXmlSocketServerTest


    @BeforeClass
    public static void setupClass() throws Exception {
        ((LoggerContext) LogManager.getContext(false)).reconfigure();
        // Use a tiny buffer just to test the code, the TCP test uses a large buffer
        server = new UdpSocketServer<>(PORT_NUM, new XmlInputStreamLogEventBridge(100,
                Charset.defaultCharset()));
        thread = server.startNewThread();
    }

    @BeforeClass
    public static void setupClass() throws Exception {
        ((LoggerContext) LogManager.getContext(false)).reconfigure();
        // Use a tiny buffer just to test the code, the TCP test uses a large buffer
        server = new UdpSocketServer<InputStream>(PORT_NUM, new XmlInputStreamLogEventBridge(100,
                Charset.defaultCharset()));
        thread = server.startNewThread();
    }

Replace Generic With Diamond UdpSocketServer<InputStream> with UdpSocketServer<> in method public setupClass() : void from class org.apache.logging.log4j.core.net.server.UdpXmlSocketServerTest


    private static ArrayList<String> generateMessages(final int numberOfMessages, final String charSet) {
        final ArrayList<String> messageList = new ArrayList<>(numberOfMessages);
        for (int i = 0; i < numberOfMessages; i++) {
            final String message = createRandomMessage(charSet);
            messageList.add(message);
        }
        return messageList;
    }

    private static ArrayList<String> generateMessages(final int numberOfMessages, final String charSet) {
        final ArrayList<String> messageList = new ArrayList<String>(numberOfMessages);
        for (int i = 0; i < numberOfMessages; i++) {
            final String message = createRandomMessage(charSet);
            messageList.add(message);
        }
        return messageList;
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private generateMessages(numberOfMessages int, charSet String) : ArrayList<String> from class org.apache.logging.log4j.core.net.ssl.TlsSyslogTestUtil


    /**
     * Test the custom pattern
     */
    @Test
    public void testCustomPattern() {
        final List<PatternFormatter> formatters = parser.parse(customPattern);
        assertNotNull(formatters);
        final Map<String, String> mdc = new HashMap<>();
        mdc.put("loginId", "Fred");
        final Throwable t = new Throwable();
        final StackTraceElement[] elements = t.getStackTrace();
        final LogEvent event = new Log4jLogEvent("org.apache.logging.log4j.PatternParserTest", MarkerManager.getMarker("TEST"),
            Logger.class.getName(), Level.INFO, new SimpleMessage("Hello, world"), null,
            mdc, null, "Thread1", elements[0], System.currentTimeMillis());
        final StringBuilder buf = new StringBuilder();
        for (final PatternFormatter formatter : formatters) {
            formatter.format(event, buf);
        }
        final String str = buf.toString();
        final String expected = "INFO  [PatternParserTest        :97  ] - Hello, world" + Constants.LINE_SEPARATOR;
        assertTrue("Expected to end with: " + expected + ". Actual: " + str, str.endsWith(expected));
    }

    /**
     * Test the custom pattern
     */
    @Test
    public void testCustomPattern() {
        final List<PatternFormatter> formatters = parser.parse(customPattern);
        assertNotNull(formatters);
        final Map<String, String> mdc = new HashMap<String, String>();
        mdc.put("loginId", "Fred");
        final Throwable t = new Throwable();
        final StackTraceElement[] elements = t.getStackTrace();
        final LogEvent event = new Log4jLogEvent("org.apache.logging.log4j.PatternParserTest", MarkerManager.getMarker("TEST"),
            Logger.class.getName(), Level.INFO, new SimpleMessage("Hello, world"), null,
            mdc, null, "Thread1", elements[0], System.currentTimeMillis());
        final StringBuilder buf = new StringBuilder();
        for (final PatternFormatter formatter : formatters) {
            formatter.format(event, buf);
        }
        final String str = buf.toString();
        final String expected = "INFO  [PatternParserTest        :97  ] - Hello, world" + Constants.LINE_SEPARATOR;
        assertTrue("Expected to end with: " + expected + ". Actual: " + str, str.endsWith(expected));
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public testCustomPattern() : void from class org.apache.logging.log4j.core.pattern.PatternParserTest


    public CleanFiles(final String... fileNames) {
        this.files = new ArrayList<>(fileNames.length);
        for (final String fileName : fileNames) {
            this.files.add(new File(fileName));
        }
    }

    public CleanFiles(final String... fileNames) {
        this.files = new ArrayList<File>(fileNames.length);
        for (final String fileName : fileNames) {
            this.files.add(new File(fileName));
        }
    }

Replace Generic With Diamond ArrayList<File> with ArrayList<> in method public CleanFiles(fileNames String...) from class org.apache.logging.log4j.junit.CleanFiles


    public List<LogEvent> getEvents() {
        final List<LogEvent> list = new ArrayList<>(events);
        events.clear();
        return list;
    }

    public List<LogEvent> getEvents() {
        final List<LogEvent> list = new ArrayList<LogEvent>(events);
        events.clear();
        return list;
    }

Replace Generic With Diamond ArrayList<LogEvent> with ArrayList<> in method public getEvents() : List<LogEvent> from class org.apache.logging.log4j.test.appender.FailOnceAppender


    /**
     * This method is not exposed through the public API and is used primarily for unit testing.
     * @return An Iterator over all the Filters associated with the Logger.
     */
    // FIXME: this really ought to be an Iterable instead of an Iterator
    public Iterator<Filter> getFilters() {
        final Filter filter = config.loggerConfig.getFilter();
        if (filter == null) {
            return new ArrayList<Filter>().iterator();
        } else if (filter instanceof CompositeFilter) {
            return ((CompositeFilter) filter).iterator();
        } else {
            final List<Filter> filters = new ArrayList<>();
            filters.add(filter);
            return filters.iterator();
        }
    }

    /**
     * This method is not exposed through the public API and is used primarily for unit testing.
     * @return An Iterator over all the Filters associated with the Logger.
     */
    // FIXME: this really ought to be an Iterable instead of an Iterator
    public Iterator<Filter> getFilters() {
        final Filter filter = config.loggerConfig.getFilter();
        if (filter == null) {
            return new ArrayList<Filter>().iterator();
        } else if (filter instanceof CompositeFilter) {
            return ((CompositeFilter) filter).iterator();
        } else {
            final List<Filter> filters = new ArrayList<Filter>();
            filters.add(filter);
            return filters.iterator();
        }
    }

Replace Generic With Diamond ArrayList<Filter> with ArrayList<> in method public getFilters() : Iterator<Filter> from class org.apache.logging.log4j.core.Logger


    /**
     * Provide a description of the content format supported by this Manager.  Default implementation returns an empty
     * (unspecified) Map.
     *
     * @return a Map of key/value pairs describing the Manager-specific content format, or an empty Map if no content
     * format descriptors are specified.
     */
    public Map<String, String> getContentFormat() {
        return new HashMap<>();
    }

    /**
     * Provide a description of the content format supported by this Manager.  Default implementation returns an empty
     * (unspecified) Map.
     *
     * @return a Map of key/value pairs describing the Manager-specific content format, or an empty Map if no content
     * format descriptors are specified.
     */
    public Map<String, String> getContentFormat() {
        return new HashMap<String, String>();
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public getContentFormat() : Map<String,String> from class org.apache.logging.log4j.core.appender.AbstractManager


    private AsyncAppender(final String name, final Filter filter, final AppenderRef[] appenderRefs,
                           final String errorRef, final int queueSize, final boolean blocking,
                           final boolean ignoreExceptions, final Configuration config,
                           final boolean includeLocation) {
        super(name, filter, null, ignoreExceptions);
        this.queue = new ArrayBlockingQueue<>(queueSize);
        this.queueSize = queueSize;
        this.blocking = blocking;
        this.config = config;
        this.appenderRefs = appenderRefs;
        this.errorRef = errorRef;
        this.includeLocation = includeLocation;
    }

    private AsyncAppender(final String name, final Filter filter, final AppenderRef[] appenderRefs,
                           final String errorRef, final int queueSize, final boolean blocking,
                           final boolean ignoreExceptions, final Configuration config,
                           final boolean includeLocation) {
        super(name, filter, null, ignoreExceptions);
        this.queue = new ArrayBlockingQueue<Serializable>(queueSize);
        this.queueSize = queueSize;
        this.blocking = blocking;
        this.config = config;
        this.appenderRefs = appenderRefs;
        this.errorRef = errorRef;
        this.includeLocation = includeLocation;
    }

Replace Generic With Diamond ArrayBlockingQueue<Serializable> with ArrayBlockingQueue<> in method private AsyncAppender(name String, filter Filter, appenderRefs AppenderRef[], errorRef String, queueSize int, blocking boolean, ignoreExceptions boolean, config Configuration, includeLocation boolean) from class org.apache.logging.log4j.core.appender.AsyncAppender


    @Override
    public void start() {
        final Map<String, Appender> map = config.getAppenders();
        final List<AppenderControl> appenders = new ArrayList<>();
        for (final AppenderRef appenderRef : appenderRefs) {
            if (map.containsKey(appenderRef.getRef())) {
                appenders.add(new AppenderControl(map.get(appenderRef.getRef()), appenderRef.getLevel(),
                    appenderRef.getFilter()));
            } else {
                LOGGER.error("No appender named {} was configured", appenderRef);
            }
        }
        if (errorRef != null) {
            if (map.containsKey(errorRef)) {
                errorAppender = new AppenderControl(map.get(errorRef), null, null);
            } else {
                LOGGER.error("Unable to set up error Appender. No appender named {} was configured", errorRef);
            }
        }
        if (appenders.size() > 0) {
            thread = new AsyncThread(appenders, queue);
            thread.setName("AsyncAppender-" + getName());
        } else if (errorRef == null) {
            throw new ConfigurationException("No appenders are available for AsyncAppender " + getName());
        }

        thread.start();
        super.start();
    }

    @Override
    public void start() {
        final Map<String, Appender> map = config.getAppenders();
        final List<AppenderControl> appenders = new ArrayList<AppenderControl>();
        for (final AppenderRef appenderRef : appenderRefs) {
            if (map.containsKey(appenderRef.getRef())) {
                appenders.add(new AppenderControl(map.get(appenderRef.getRef()), appenderRef.getLevel(),
                    appenderRef.getFilter()));
            } else {
                LOGGER.error("No appender named {} was configured", appenderRef);
            }
        }
        if (errorRef != null) {
            if (map.containsKey(errorRef)) {
                errorAppender = new AppenderControl(map.get(errorRef), null, null);
            } else {
                LOGGER.error("Unable to set up error Appender. No appender named {} was configured", errorRef);
            }
        }
        if (appenders.size() > 0) {
            thread = new AsyncThread(appenders, queue);
            thread.setName("AsyncAppender-" + getName());
        } else if (errorRef == null) {
            throw new ConfigurationException("No appenders are available for AsyncAppender " + getName());
        }

        thread.start();
        super.start();
    }

Replace Generic With Diamond ArrayList<AppenderControl> with ArrayList<> in method public start() : void from class org.apache.logging.log4j.core.appender.AsyncAppender


    private FileAppender(final String name, final Layout<? extends Serializable> layout, final Filter filter, final FileManager manager,
                         final String filename, final boolean ignoreExceptions, final boolean immediateFlush,
                         final Advertiser advertiser) {
        super(name, layout, filter, ignoreExceptions, immediateFlush, manager);
        if (advertiser != null) {
            final Map<String, String> configuration = new HashMap<>(layout.getContentFormat());
            configuration.putAll(manager.getContentFormat());
            configuration.put("contentType", layout.getContentType());
            configuration.put("name", name);
            advertisement = advertiser.advertise(configuration);
        }
        this.fileName = filename;
        this.advertiser = advertiser;
    }

    private FileAppender(final String name, final Layout<? extends Serializable> layout, final Filter filter, final FileManager manager,
                         final String filename, final boolean ignoreExceptions, final boolean immediateFlush,
                         final Advertiser advertiser) {
        super(name, layout, filter, ignoreExceptions, immediateFlush, manager);
        if (advertiser != null) {
            final Map<String, String> configuration = new HashMap<String, String>(layout.getContentFormat());
            configuration.putAll(manager.getContentFormat());
            configuration.put("contentType", layout.getContentType());
            configuration.put("name", name);
            advertisement = advertiser.advertise(configuration);
        }
        this.fileName = filename;
        this.advertiser = advertiser;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method private FileAppender(name String, layout Layout<? extends Serializable>, filter Filter, manager FileManager, filename String, ignoreExceptions boolean, immediateFlush boolean, advertiser Advertiser) from class org.apache.logging.log4j.core.appender.FileAppender


/**
     * FileManager's content format is specified by: Key: "fileURI" Value: provided "advertiseURI" param.
     *
     * @return Map of content format keys supporting FileManager
     */
    @Override
    public Map<String, String> getContentFormat() {
        final Map<String, String> result = new HashMap<>(super.getContentFormat());
        result.put("fileURI", advertiseURI);
        return result;
    }

/**
     * FileManager's content format is specified by: Key: "fileURI" Value: provided "advertiseURI" param.
     *
     * @return Map of content format keys supporting FileManager
     */
    @Override
    public Map<String, String> getContentFormat() {
        final Map<String, String> result = new HashMap<String, String>(super.getContentFormat());
        result.put("fileURI", advertiseURI);
        return result;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public getContentFormat() : Map<String,String> from class org.apache.logging.log4j.core.appender.FileManager


    private MemoryMappedFileAppender(final String name, final Layout<? extends Serializable> layout,
            final Filter filter, final MemoryMappedFileManager manager, final String filename,
            final boolean ignoreExceptions, final boolean immediateFlush, final Advertiser advertiser) {
        super(name, layout, filter, ignoreExceptions, immediateFlush, manager);
        if (advertiser != null) {
            final Map<String, String> configuration = new HashMap<>(layout.getContentFormat());
            configuration.putAll(manager.getContentFormat());
            configuration.put("contentType", layout.getContentType());
            configuration.put("name", name);
            advertisement = advertiser.advertise(configuration);
        }
        this.fileName = filename;
        this.advertiser = advertiser;
    }

    private MemoryMappedFileAppender(final String name, final Layout<? extends Serializable> layout,
            final Filter filter, final MemoryMappedFileManager manager, final String filename,
            final boolean ignoreExceptions, final boolean immediateFlush, final Advertiser advertiser) {
        super(name, layout, filter, ignoreExceptions, immediateFlush, manager);
        if (advertiser != null) {
            final Map<String, String> configuration = new HashMap<String, String>(layout.getContentFormat());
            configuration.putAll(manager.getContentFormat());
            configuration.put("contentType", layout.getContentType());
            configuration.put("name", name);
            advertisement = advertiser.advertise(configuration);
        }
        this.fileName = filename;
        this.advertiser = advertiser;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method private MemoryMappedFileAppender(name String, layout Layout<? extends Serializable>, filter Filter, manager MemoryMappedFileManager, filename String, ignoreExceptions boolean, immediateFlush boolean, advertiser Advertiser) from class org.apache.logging.log4j.core.appender.MemoryMappedFileAppender


    /**
     * Gets this FileManager's content format specified by:
     * <p>
     * Key: "fileURI" Value: provided "advertiseURI" param.
     * </p>
     *
     * @return Map of content format keys supporting FileManager
     */
    @Override
    public Map<String, String> getContentFormat() {
        final Map<String, String> result = new HashMap<>(super.getContentFormat());
        result.put("fileURI", advertiseURI);
        return result;
    }

    /**
     * Gets this FileManager's content format specified by:
     * <p>
     * Key: "fileURI" Value: provided "advertiseURI" param.
     * </p>
     *
     * @return Map of content format keys supporting FileManager
     */
    @Override
    public Map<String, String> getContentFormat() {
        final Map<String, String> result = new HashMap<String, String>(super.getContentFormat());
        result.put("fileURI", advertiseURI);
        return result;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public getContentFormat() : Map<String,String> from class org.apache.logging.log4j.core.appender.MemoryMappedFileManager


    private RandomAccessFileAppender(final String name, final Layout<? extends Serializable> layout, final Filter filter,
            final RandomAccessFileManager manager, final String filename, final boolean ignoreExceptions,
            final boolean immediateFlush, final Advertiser advertiser) {
        super(name, layout, filter, ignoreExceptions, immediateFlush, manager);
        if (advertiser != null) {
            final Map<String, String> configuration = new HashMap<>(
                    layout.getContentFormat());
            configuration.putAll(manager.getContentFormat());
            configuration.put("contentType", layout.getContentType());
            configuration.put("name", name);
            advertisement = advertiser.advertise(configuration);
        }
        this.fileName = filename;
        this.advertiser = advertiser;
    }

    private RandomAccessFileAppender(final String name, final Layout<? extends Serializable> layout, final Filter filter,
            final RandomAccessFileManager manager, final String filename, final boolean ignoreExceptions,
            final boolean immediateFlush, final Advertiser advertiser) {
        super(name, layout, filter, ignoreExceptions, immediateFlush, manager);
        if (advertiser != null) {
            final Map<String, String> configuration = new HashMap<String, String>(
                    layout.getContentFormat());
            configuration.putAll(manager.getContentFormat());
            configuration.put("contentType", layout.getContentType());
            configuration.put("name", name);
            advertisement = advertiser.advertise(configuration);
        }
        this.fileName = filename;
        this.advertiser = advertiser;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method private RandomAccessFileAppender(name String, layout Layout<? extends Serializable>, filter Filter, manager RandomAccessFileManager, filename String, ignoreExceptions boolean, immediateFlush boolean, advertiser Advertiser) from class org.apache.logging.log4j.core.appender.RandomAccessFileAppender


    /**
     * Gets this FileManager's content format specified by:
     * <p>
     * Key: "fileURI" Value: provided "advertiseURI" param.
     * </p>
     *
     * @return Map of content format keys supporting FileManager
     */
    @Override
    public Map<String, String> getContentFormat() {
        final Map<String, String> result = new HashMap<>(
                super.getContentFormat());
        result.put("fileURI", advertiseURI);
        return result;
    }

    /**
     * Gets this FileManager's content format specified by:
     * <p>
     * Key: "fileURI" Value: provided "advertiseURI" param.
     * </p>
     *
     * @return Map of content format keys supporting FileManager
     */
    @Override
    public Map<String, String> getContentFormat() {
        final Map<String, String> result = new HashMap<String, String>(
                super.getContentFormat());
        result.put("fileURI", advertiseURI);
        return result;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public getContentFormat() : Map<String,String> from class org.apache.logging.log4j.core.appender.RandomAccessFileManager


    private RollingFileAppender(final String name, final Layout<? extends Serializable> layout, final Filter filter,
            final RollingFileManager manager, final String fileName, final String filePattern,
            final boolean ignoreExceptions, final boolean immediateFlush, final Advertiser advertiser) {
        super(name, layout, filter, ignoreExceptions, immediateFlush, manager);
        if (advertiser != null) {
            final Map<String, String> configuration = new HashMap<>(layout.getContentFormat());
            configuration.put("contentType", layout.getContentType());
            configuration.put("name", name);
            advertisement = advertiser.advertise(configuration);
        }
        this.fileName = fileName;
        this.filePattern = filePattern;
        this.advertiser = advertiser;
    }

    private RollingFileAppender(final String name, final Layout<? extends Serializable> layout, final Filter filter,
            final RollingFileManager manager, final String fileName, final String filePattern,
            final boolean ignoreExceptions, final boolean immediateFlush, final Advertiser advertiser) {
        super(name, layout, filter, ignoreExceptions, immediateFlush, manager);
        if (advertiser != null) {
            final Map<String, String> configuration = new HashMap<String, String>(layout.getContentFormat());
            configuration.put("contentType", layout.getContentType());
            configuration.put("name", name);
            advertisement = advertiser.advertise(configuration);
        }
        this.fileName = fileName;
        this.filePattern = filePattern;
        this.advertiser = advertiser;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method private RollingFileAppender(name String, layout Layout<? extends Serializable>, filter Filter, manager RollingFileManager, fileName String, filePattern String, ignoreExceptions boolean, immediateFlush boolean, advertiser Advertiser) from class org.apache.logging.log4j.core.appender.RollingFileAppender


    private RollingRandomAccessFileAppender(final String name, final Layout<? extends Serializable> layout,
            final Filter filter, final RollingFileManager manager, final String fileName,
            final String filePattern, final boolean ignoreExceptions,
            final boolean immediateFlush, final int bufferSize, final Advertiser advertiser) {
        super(name, layout, filter, ignoreExceptions, immediateFlush, manager);
        if (advertiser != null) {
            final Map<String, String> configuration = new HashMap<>(layout.getContentFormat());
            configuration.put("contentType", layout.getContentType());
            configuration.put("name", name);
            advertisement = advertiser.advertise(configuration);
        }
        this.fileName = fileName;
        this.filePattern = filePattern;
        this.advertiser = advertiser;
    }

    private RollingRandomAccessFileAppender(final String name, final Layout<? extends Serializable> layout,
            final Filter filter, final RollingFileManager manager, final String fileName,
            final String filePattern, final boolean ignoreExceptions,
            final boolean immediateFlush, final int bufferSize, final Advertiser advertiser) {
        super(name, layout, filter, ignoreExceptions, immediateFlush, manager);
        if (advertiser != null) {
            final Map<String, String> configuration = new HashMap<String, String>(layout.getContentFormat());
            configuration.put("contentType", layout.getContentType());
            configuration.put("name", name);
            advertisement = advertiser.advertise(configuration);
        }
        this.fileName = fileName;
        this.filePattern = filePattern;
        this.advertiser = advertiser;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method private RollingRandomAccessFileAppender(name String, layout Layout<? extends Serializable>, filter Filter, manager RollingFileManager, fileName String, filePattern String, ignoreExceptions boolean, immediateFlush boolean, bufferSize int, advertiser Advertiser) from class org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender


    protected SocketAppender(final String name, final Layout<? extends Serializable> layout, final Filter filter,
            final AbstractSocketManager manager, final boolean ignoreExceptions, final boolean immediateFlush,
            final Advertiser advertiser) {
        super(name, layout, filter, ignoreExceptions, immediateFlush, manager);
        if (advertiser != null) {
            final Map<String, String> configuration = new HashMap<>(layout.getContentFormat());
            configuration.putAll(manager.getContentFormat());
            configuration.put("contentType", layout.getContentType());
            configuration.put("name", name);
            this.advertisement = advertiser.advertise(configuration);
        }
        this.advertiser = advertiser;
    }

    protected SocketAppender(final String name, final Layout<? extends Serializable> layout, final Filter filter,
            final AbstractSocketManager manager, final boolean ignoreExceptions, final boolean immediateFlush,
            final Advertiser advertiser) {
        super(name, layout, filter, ignoreExceptions, immediateFlush, manager);
        if (advertiser != null) {
            final Map<String, String> configuration = new HashMap<String, String>(layout.getContentFormat());
            configuration.putAll(manager.getContentFormat());
            configuration.put("contentType", layout.getContentType());
            configuration.put("name", name);
            this.advertisement = advertiser.advertise(configuration);
        }
        this.advertiser = advertiser;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method protected SocketAppender(name String, layout Layout<? extends Serializable>, filter Filter, manager AbstractSocketManager, ignoreExceptions boolean, immediateFlush boolean, advertiser Advertiser) from class org.apache.logging.log4j.core.appender.SocketAppender


    /**
     * Instantiates the base manager.
     *
     * @param name The manager name, which should include any configuration details that one might want to be able to
     *             reconfigure at runtime, such as database name, username, (hashed) password, etc.
     * @param bufferSize The size of the log event buffer.
     */
    protected AbstractDatabaseManager(final String name, final int bufferSize) {
        super(name);
        this.bufferSize = bufferSize;
        this.buffer = new ArrayList<>(bufferSize + 1);
    }

    /**
     * Instantiates the base manager.
     *
     * @param name The manager name, which should include any configuration details that one might want to be able to
     *             reconfigure at runtime, such as database name, username, (hashed) password, etc.
     * @param bufferSize The size of the log event buffer.
     */
    protected AbstractDatabaseManager(final String name, final int bufferSize) {
        super(name);
        this.bufferSize = bufferSize;
        this.buffer = new ArrayList<LogEvent>(bufferSize + 1);
    }

Replace Generic With Diamond ArrayList<LogEvent> with ArrayList<> in method protected AbstractDatabaseManager(name String, bufferSize int) from class org.apache.logging.log4j.core.appender.db.AbstractDatabaseManager


    /**
     * Purge and rename old log files in preparation for rollover. The oldest file will have the smallest index,
     * the newest the highest.
     *
     * @param lowIndex  low index
     * @param highIndex high index.  Log file associated with high index will be deleted if needed.
     * @param manager The RollingFileManager
     * @return true if purge was successful and rollover should be attempted.
     */
    private int purgeAscending(final int lowIndex, final int highIndex, final RollingFileManager manager) {
        int suffixLength = 0;

        final List<FileRenameAction> renames = new ArrayList<>();
        final StringBuilder buf = new StringBuilder();

        // LOG4J2-531: directory scan & rollover must use same format
        manager.getPatternProcessor().formatFileName(subst, buf, highIndex);

        String highFilename = subst.replace(buf);

        if (highFilename.endsWith(EXT_GZIP)) {
            suffixLength = EXT_GZIP.length();
        } else if (highFilename.endsWith(EXT_ZIP)) {
            suffixLength = EXT_ZIP.length();
        }

        int maxIndex = 0;

        for (int i = highIndex; i >= lowIndex; i--) {
            File toRename = new File(highFilename);
            if (i == highIndex && toRename.exists()) {
                maxIndex = highIndex;
            } else if (maxIndex == 0 && toRename.exists()) {
                maxIndex = i + 1;
                break;
            }

            boolean isBase = false;

            if (suffixLength > 0) {
                final File toRenameBase =
                    new File(highFilename.substring(0, highFilename.length() - suffixLength));

                if (toRename.exists()) {
                    if (toRenameBase.exists()) {
                        LOGGER.debug("DefaultRolloverStrategy.purgeAscending deleting {} base of {}.", //
                                toRenameBase, toRename);
                        toRenameBase.delete();
                    }
                } else {
                    toRename = toRenameBase;
                    isBase = true;
                }
            }

            if (toRename.exists()) {
                //
                //    if at lower index and then all slots full
                //        attempt to delete last file
                //        if that fails then abandon purge
                if (i == lowIndex) {
                    LOGGER.debug("DefaultRolloverStrategy.purgeAscending deleting {} at low index {}: all slots full.", //
                            toRename, i);
                    if (!toRename.delete()) {
                        return -1;
                    }

                    break;
                }

                //
                //   if intermediate index
                //     add a rename action to the list
                buf.setLength(0);
                // LOG4J2-531: directory scan & rollover must use same format
                manager.getPatternProcessor().formatFileName(subst, buf, i - 1);

                final String lowFilename = subst.replace(buf);
                String renameTo = lowFilename;

                if (isBase) {
                    renameTo = lowFilename.substring(0, lowFilename.length() - suffixLength);
                }

                renames.add(new FileRenameAction(toRename, new File(renameTo), true));
                highFilename = lowFilename;
            } else {
                buf.setLength(0);
                // LOG4J2-531: directory scan & rollover must use same format
                manager.getPatternProcessor().formatFileName(subst, buf, i - 1);

                highFilename = subst.replace(buf);
            }
        }
        if (maxIndex == 0) {
            maxIndex = lowIndex;
        }

        //
        //   work renames backwards
        //
        for (int i = renames.size() - 1; i >= 0; i--) {
            final Action action = renames.get(i);
            try {
                LOGGER.debug("DefaultRolloverStrategy.purgeAscending executing {} of {}: {}", //
                        i, renames.size(), action);
                if (!action.execute()) {
                    return -1;
                }
            } catch (final Exception ex) {
                LOGGER.warn("Exception during purge in RollingFileAppender", ex);
                return -1;
            }
        }
        return maxIndex;
    }

    /**
     * Purge and rename old log files in preparation for rollover. The oldest file will have the smallest index,
     * the newest the highest.
     *
     * @param lowIndex  low index
     * @param highIndex high index.  Log file associated with high index will be deleted if needed.
     * @param manager The RollingFileManager
     * @return true if purge was successful and rollover should be attempted.
     */
    private int purgeAscending(final int lowIndex, final int highIndex, final RollingFileManager manager) {
        int suffixLength = 0;

        final List<FileRenameAction> renames = new ArrayList<FileRenameAction>();
        final StringBuilder buf = new StringBuilder();

        // LOG4J2-531: directory scan & rollover must use same format
        manager.getPatternProcessor().formatFileName(subst, buf, highIndex);

        String highFilename = subst.replace(buf);

        if (highFilename.endsWith(EXT_GZIP)) {
            suffixLength = EXT_GZIP.length();
        } else if (highFilename.endsWith(EXT_ZIP)) {
            suffixLength = EXT_ZIP.length();
        }

        int maxIndex = 0;

        for (int i = highIndex; i >= lowIndex; i--) {
            File toRename = new File(highFilename);
            if (i == highIndex && toRename.exists()) {
                maxIndex = highIndex;
            } else if (maxIndex == 0 && toRename.exists()) {
                maxIndex = i + 1;
                break;
            }

            boolean isBase = false;

            if (suffixLength > 0) {
                final File toRenameBase =
                    new File(highFilename.substring(0, highFilename.length() - suffixLength));

                if (toRename.exists()) {
                    if (toRenameBase.exists()) {
                        LOGGER.debug("DefaultRolloverStrategy.purgeAscending deleting {} base of {}.", //
                                toRenameBase, toRename);
                        toRenameBase.delete();
                    }
                } else {
                    toRename = toRenameBase;
                    isBase = true;
                }
            }

            if (toRename.exists()) {
                //
                //    if at lower index and then all slots full
                //        attempt to delete last file
                //        if that fails then abandon purge
                if (i == lowIndex) {
                    LOGGER.debug("DefaultRolloverStrategy.purgeAscending deleting {} at low index {}: all slots full.", //
                            toRename, i);
                    if (!toRename.delete()) {
                        return -1;
                    }

                    break;
                }

                //
                //   if intermediate index
                //     add a rename action to the list
                buf.setLength(0);
                // LOG4J2-531: directory scan & rollover must use same format
                manager.getPatternProcessor().formatFileName(subst, buf, i - 1);

                final String lowFilename = subst.replace(buf);
                String renameTo = lowFilename;

                if (isBase) {
                    renameTo = lowFilename.substring(0, lowFilename.length() - suffixLength);
                }

                renames.add(new FileRenameAction(toRename, new File(renameTo), true));
                highFilename = lowFilename;
            } else {
                buf.setLength(0);
                // LOG4J2-531: directory scan & rollover must use same format
                manager.getPatternProcessor().formatFileName(subst, buf, i - 1);

                highFilename = subst.replace(buf);
            }
        }
        if (maxIndex == 0) {
            maxIndex = lowIndex;
        }

        //
        //   work renames backwards
        //
        for (int i = renames.size() - 1; i >= 0; i--) {
            final Action action = renames.get(i);
            try {
                LOGGER.debug("DefaultRolloverStrategy.purgeAscending executing {} of {}: {}", //
                        i, renames.size(), action);
                if (!action.execute()) {
                    return -1;
                }
            } catch (final Exception ex) {
                LOGGER.warn("Exception during purge in RollingFileAppender", ex);
                return -1;
            }
        }
        return maxIndex;
    }

Replace Generic With Diamond ArrayList<FileRenameAction> with ArrayList<> in method private purgeAscending(lowIndex int, highIndex int, manager RollingFileManager) : int from class org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy


    /**
     * Purge and rename old log files in preparation for rollover. The newest file will have the smallest index, the
     * oldest will have the highest.
     *
     * @param lowIndex  low index
     * @param highIndex high index.  Log file associated with high index will be deleted if needed.
     * @param manager The RollingFileManager
     * @return true if purge was successful and rollover should be attempted.
     */
    private int purgeDescending(final int lowIndex, final int highIndex, final RollingFileManager manager) {
        int suffixLength = 0;

        final List<FileRenameAction> renames = new ArrayList<>();
        final StringBuilder buf = new StringBuilder();

        // LOG4J2-531: directory scan & rollover must use same format
        manager.getPatternProcessor().formatFileName(subst, buf, lowIndex);

        String lowFilename = subst.replace(buf);

        if (lowFilename.endsWith(EXT_GZIP)) {
            suffixLength = EXT_GZIP.length();
        } else if (lowFilename.endsWith(EXT_ZIP)) {
            suffixLength = EXT_ZIP.length();
        }

        for (int i = lowIndex; i <= highIndex; i++) {
            File toRename = new File(lowFilename);
            boolean isBase = false;

            if (suffixLength > 0) {
                final File toRenameBase =
                    new File(lowFilename.substring(0, lowFilename.length() - suffixLength));

                if (toRename.exists()) {
                    if (toRenameBase.exists()) {
                        LOGGER.debug("DefaultRolloverStrategy.purgeDescending deleting {} base of {}.", //
                                toRenameBase, toRename);
                        toRenameBase.delete();
                    }
                } else {
                    toRename = toRenameBase;
                    isBase = true;
                }
            }

            if (toRename.exists()) {
                //
                //    if at upper index then
                //        attempt to delete last file
                //        if that fails then abandon purge
                if (i == highIndex) {
                    LOGGER.debug("DefaultRolloverStrategy.purgeDescending deleting {} at high index {}: all slots full.", //
                            toRename, i);
                    if (!toRename.delete()) {
                        return -1;
                    }

                    break;
                }

                //
                //   if intermediate index
                //     add a rename action to the list
                buf.setLength(0);
                // LOG4J2-531: directory scan & rollover must use same format
                manager.getPatternProcessor().formatFileName(subst, buf, i + 1);

                final String highFilename = subst.replace(buf);
                String renameTo = highFilename;

                if (isBase) {
                    renameTo = highFilename.substring(0, highFilename.length() - suffixLength);
                }

                renames.add(new FileRenameAction(toRename, new File(renameTo), true));
                lowFilename = highFilename;
            } else {
                break;
            }
        }

        //
        //   work renames backwards
        //
        for (int i = renames.size() - 1; i >= 0; i--) {
            final Action action = renames.get(i);
            try {
                LOGGER.debug("DefaultRolloverStrategy.purgeDescending executing {} of {}: {}", //
                        i, renames.size(), action);
                if (!action.execute()) {
                    return -1;
                }
            } catch (final Exception ex) {
                LOGGER.warn("Exception during purge in RollingFileAppender", ex);
                return -1;
            }
        }

        return lowIndex;
    }

    /**
     * Purge and rename old log files in preparation for rollover. The newest file will have the smallest index, the
     * oldest will have the highest.
     *
     * @param lowIndex  low index
     * @param highIndex high index.  Log file associated with high index will be deleted if needed.
     * @param manager The RollingFileManager
     * @return true if purge was successful and rollover should be attempted.
     */
    private int purgeDescending(final int lowIndex, final int highIndex, final RollingFileManager manager) {
        int suffixLength = 0;

        final List<FileRenameAction> renames = new ArrayList<FileRenameAction>();
        final StringBuilder buf = new StringBuilder();

        // LOG4J2-531: directory scan & rollover must use same format
        manager.getPatternProcessor().formatFileName(subst, buf, lowIndex);

        String lowFilename = subst.replace(buf);

        if (lowFilename.endsWith(EXT_GZIP)) {
            suffixLength = EXT_GZIP.length();
        } else if (lowFilename.endsWith(EXT_ZIP)) {
            suffixLength = EXT_ZIP.length();
        }

        for (int i = lowIndex; i <= highIndex; i++) {
            File toRename = new File(lowFilename);
            boolean isBase = false;

            if (suffixLength > 0) {
                final File toRenameBase =
                    new File(lowFilename.substring(0, lowFilename.length() - suffixLength));

                if (toRename.exists()) {
                    if (toRenameBase.exists()) {
                        LOGGER.debug("DefaultRolloverStrategy.purgeDescending deleting {} base of {}.", //
                                toRenameBase, toRename);
                        toRenameBase.delete();
                    }
                } else {
                    toRename = toRenameBase;
                    isBase = true;
                }
            }

            if (toRename.exists()) {
                //
                //    if at upper index then
                //        attempt to delete last file
                //        if that fails then abandon purge
                if (i == highIndex) {
                    LOGGER.debug("DefaultRolloverStrategy.purgeDescending deleting {} at high index {}: all slots full.", //
                            toRename, i);
                    if (!toRename.delete()) {
                        return -1;
                    }

                    break;
                }

                //
                //   if intermediate index
                //     add a rename action to the list
                buf.setLength(0);
                // LOG4J2-531: directory scan & rollover must use same format
                manager.getPatternProcessor().formatFileName(subst, buf, i + 1);

                final String highFilename = subst.replace(buf);
                String renameTo = highFilename;

                if (isBase) {
                    renameTo = highFilename.substring(0, highFilename.length() - suffixLength);
                }

                renames.add(new FileRenameAction(toRename, new File(renameTo), true));
                lowFilename = highFilename;
            } else {
                break;
            }
        }

        //
        //   work renames backwards
        //
        for (int i = renames.size() - 1; i >= 0; i--) {
            final Action action = renames.get(i);
            try {
                LOGGER.debug("DefaultRolloverStrategy.purgeDescending executing {} of {}: {}", //
                        i, renames.size(), action);
                if (!action.execute()) {
                    return -1;
                }
            } catch (final Exception ex) {
                LOGGER.warn("Exception during purge in RollingFileAppender", ex);
                return -1;
            }
        }

        return lowIndex;
    }

Replace Generic With Diamond ArrayList<FileRenameAction> with ArrayList<> in method private purgeDescending(lowIndex int, highIndex int, manager RollingFileManager) : int from class org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy


    private static Map<String, String> createMap(final List<Property> properties) {
        final Map<String, String> contextMap = ThreadContext.getImmutableContext();
        if (contextMap == null && (properties == null || properties.isEmpty())) {
            return null;
        }
        if (properties == null || properties.isEmpty()) {
            return contextMap; // contextMap is not null
        }
        final Map<String, String> map = new HashMap<>(contextMap);

        for (final Property prop : properties) {
            if (!map.containsKey(prop.getName())) {
                map.put(prop.getName(), prop.getValue());
            }
        }
        return Collections.unmodifiableMap(map);
    }

    private static Map<String, String> createMap(final List<Property> properties) {
        final Map<String, String> contextMap = ThreadContext.getImmutableContext();
        if (contextMap == null && (properties == null || properties.isEmpty())) {
            return null;
        }
        if (properties == null || properties.isEmpty()) {
            return contextMap; // contextMap is not null
        }
        final Map<String, String> map = new HashMap<String, String>(contextMap);

        for (final Property prop : properties) {
            if (!map.containsKey(prop.getName())) {
                map.put(prop.getName(), prop.getValue());
            }
        }
        return Collections.unmodifiableMap(map);
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method private createMap(properties List<Property>) : Map<String,String> from class org.apache.logging.log4j.core.impl.Log4jLogEvent


    /**
     * Create a new instance based on the array of options.
     * @param options The array of options.
     */
    public static ThrowableFormatOptions newInstance(String[] options) {
        if (options == null || options.length == 0) {
            return DEFAULT;
        }
        // NOTE: The following code is present for backward compatibility
        // and was copied from Extended/RootThrowablePatternConverter.
        // This supports a single option with the format:
        //     %xEx{["none"|"short"|"full"|depth],[filters(packages)}
        // However, the convention for multiple options should be:
        //     %xEx{["none"|"short"|"full"|depth]}[{filters(packages)}]
        if (options.length == 1 && options[0] != null && options[0].length() > 0) {
            final String[] opts = options[0].split(Patterns.COMMA_SEPARATOR, 2);
            final String first = opts[0].trim();
            final Scanner scanner = new Scanner(first);
            if (opts.length > 1 && (first.equalsIgnoreCase(FULL) || first.equalsIgnoreCase(SHORT) || first.equalsIgnoreCase(NONE) || scanner.hasNextInt())) {
                options = new String[]{first, opts[1].trim()};
            }
            scanner.close();
        }

        int lines = DEFAULT.lines;
        String separator = DEFAULT.separator;
        List<String> packages = DEFAULT.packages;
        for (final String rawOption : options) {
            if (rawOption != null) {
                final String option = rawOption.trim();
                if (option.isEmpty()) {
                    // continue;
                } else if (option.startsWith("separator(") && option.endsWith(")")) {
                    separator = option.substring("separator(".length(), option.length() - 1);
                } else if (option.startsWith("filters(") && option.endsWith(")")) {
                    final String filterStr = option.substring("filters(".length(), option.length() - 1);
                    if (filterStr.length() > 0) {
                        final String[] array = filterStr.split(Patterns.COMMA_SEPARATOR);
                        if (array.length > 0) {
                            packages = new ArrayList<>(array.length);
                            for (String token : array) {
                                token = token.trim();
                                if (token.length() > 0) {
                                    packages.add(token);
                                }
                            }
                        }
                    }
                } else if (option.equalsIgnoreCase(NONE)) {
                    lines = 0;
                } else if (option.equalsIgnoreCase(SHORT) || option.equalsIgnoreCase(CLASS_NAME) ||
                        option.equalsIgnoreCase(METHOD_NAME) || option.equalsIgnoreCase(LINE_NUMBER) ||
                        option.equalsIgnoreCase(FILE_NAME) || option.equalsIgnoreCase(MESSAGE) ||
                        option.equalsIgnoreCase(LOCALIZED_MESSAGE)) {
                    lines = 2;
                } else if (!option.equalsIgnoreCase(FULL)) {
                    lines = Integer.parseInt(option);
                }
            }
        }
        return new ThrowableFormatOptions(lines, separator, packages);
    }

    /**
     * Create a new instance based on the array of options.
     * @param options The array of options.
     */
    public static ThrowableFormatOptions newInstance(String[] options) {
        if (options == null || options.length == 0) {
            return DEFAULT;
        }
        // NOTE: The following code is present for backward compatibility
        // and was copied from Extended/RootThrowablePatternConverter.
        // This supports a single option with the format:
        //     %xEx{["none"|"short"|"full"|depth],[filters(packages)}
        // However, the convention for multiple options should be:
        //     %xEx{["none"|"short"|"full"|depth]}[{filters(packages)}]
        if (options.length == 1 && options[0] != null && options[0].length() > 0) {
            final String[] opts = options[0].split(Patterns.COMMA_SEPARATOR, 2);
            final String first = opts[0].trim();
            final Scanner scanner = new Scanner(first);
            if (opts.length > 1 && (first.equalsIgnoreCase(FULL) || first.equalsIgnoreCase(SHORT) || first.equalsIgnoreCase(NONE) || scanner.hasNextInt())) {
                options = new String[]{first, opts[1].trim()};
            }
            scanner.close();
        }

        int lines = DEFAULT.lines;
        String separator = DEFAULT.separator;
        List<String> packages = DEFAULT.packages;
        for (final String rawOption : options) {
            if (rawOption != null) {
                final String option = rawOption.trim();
                if (option.isEmpty()) {
                    // continue;
                } else if (option.startsWith("separator(") && option.endsWith(")")) {
                    separator = option.substring("separator(".length(), option.length() - 1);
                } else if (option.startsWith("filters(") && option.endsWith(")")) {
                    final String filterStr = option.substring("filters(".length(), option.length() - 1);
                    if (filterStr.length() > 0) {
                        final String[] array = filterStr.split(Patterns.COMMA_SEPARATOR);
                        if (array.length > 0) {
                            packages = new ArrayList<String>(array.length);
                            for (String token : array) {
                                token = token.trim();
                                if (token.length() > 0) {
                                    packages.add(token);
                                }
                            }
                        }
                    }
                } else if (option.equalsIgnoreCase(NONE)) {
                    lines = 0;
                } else if (option.equalsIgnoreCase(SHORT) || option.equalsIgnoreCase(CLASS_NAME) ||
                        option.equalsIgnoreCase(METHOD_NAME) || option.equalsIgnoreCase(LINE_NUMBER) ||
                        option.equalsIgnoreCase(FILE_NAME) || option.equalsIgnoreCase(MESSAGE) ||
                        option.equalsIgnoreCase(LOCALIZED_MESSAGE)) {
                    lines = 2;
                } else if (!option.equalsIgnoreCase(FULL)) {
                    lines = Integer.parseInt(option);
                }
            }
        }
        return new ThrowableFormatOptions(lines, separator, packages);
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public newInstance(options String[]) : ThrowableFormatOptions from class org.apache.logging.log4j.core.impl.ThrowableFormatOptions


    /**
     * Constructs the wrapper for the Throwable that includes packaging data.
     *
     * @param throwable
     *        The Throwable to wrap, must not be null.
     */
    public ThrowableProxy(final Throwable throwable) {
        this.throwable = throwable;
        this.name = throwable.getClass().getName();
        this.message = throwable.getMessage();
        this.localizedMessage = throwable.getLocalizedMessage();
        final Map<String, CacheEntry> map = new HashMap<>();
        final Stack<Class<?>> stack = ReflectionUtil.getCurrentStackTrace();
        this.extendedStackTrace = this.toExtendedStackTrace(stack, map, null, throwable.getStackTrace());
        final Throwable throwableCause = throwable.getCause();
        this.causeProxy = throwableCause == null ? null : new ThrowableProxy(throwable, stack, map, throwableCause);
        this.suppressedProxies = this.toSuppressedProxies(throwable);
    }

    /**
     * Constructs the wrapper for the Throwable that includes packaging data.
     *
     * @param throwable
     *        The Throwable to wrap, must not be null.
     */
    public ThrowableProxy(final Throwable throwable) {
        this.throwable = throwable;
        this.name = throwable.getClass().getName();
        this.message = throwable.getMessage();
        this.localizedMessage = throwable.getLocalizedMessage();
        final Map<String, CacheEntry> map = new HashMap<String, CacheEntry>();
        final Stack<Class<?>> stack = ReflectionUtil.getCurrentStackTrace();
        this.extendedStackTrace = this.toExtendedStackTrace(stack, map, null, throwable.getStackTrace());
        final Throwable throwableCause = throwable.getCause();
        this.causeProxy = throwableCause == null ? null : new ThrowableProxy(throwable, stack, map, throwableCause);
        this.suppressedProxies = this.toSuppressedProxies(throwable);
    }

Replace Generic With Diamond HashMap<String,CacheEntry> with HashMap<> in method public ThrowableProxy(throwable Throwable) from class org.apache.logging.log4j.core.impl.ThrowableProxy


    @Override
    public Map<String, String> deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException,
            JsonProcessingException {
        final List<MapEntry> list = jp.readValueAs(new TypeReference<List<MapEntry>>() {
            // empty
        });
        final HashMap<String, String> map = new HashMap<>(list.size());
        for (final MapEntry mapEntry : list) {
            map.put(mapEntry.getKey(), mapEntry.getValue());
        }
        return map;
    }

    @Override
    public Map<String, String> deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException,
            JsonProcessingException {
        final List<MapEntry> list = jp.readValueAs(new TypeReference<List<MapEntry>>() {
            // empty
        });
        final HashMap<String, String> map = new HashMap<String, String>(list.size());
        for (final MapEntry mapEntry : list) {
            map.put(mapEntry.getKey(), mapEntry.getValue());
        }
        return map;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public deserialize(jp JsonParser, ctxt DeserializationContext) : Map<String,String> from class org.apache.logging.log4j.core.jackson.ListOfMapEntryDeserializer


    @Override
    public Map<String, String> getContentFormat() {
        return new HashMap<>();
    }

    @Override
    public Map<String, String> getContentFormat() {
        return new HashMap<String, String>();
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public getContentFormat() : Map<String,String> from class org.apache.logging.log4j.core.layout.AbstractLayout


    private void appendThrowableAsHtml(final Throwable throwable, final StringBuilder sbuf) {
        final StringWriter sw = new StringWriter();
        final PrintWriter pw = new PrintWriter(sw);
        try {
            throwable.printStackTrace(pw);
        } catch (final RuntimeException ex) {
            // Ignore the exception.
        }
        pw.flush();
        final LineNumberReader reader = new LineNumberReader(new StringReader(sw.toString()));
        final ArrayList<String> lines = new ArrayList<>();
        try {
          String line = reader.readLine();
          while (line != null) {
            lines.add(line);
            line = reader.readLine();
          }
        } catch (final IOException ex) {
            if (ex instanceof InterruptedIOException) {
                Thread.currentThread().interrupt();
            }
            lines.add(ex.toString());
        }
        boolean first = true;
        for (final String line : lines) {
            if (!first) {
                sbuf.append(TRACE_PREFIX);
            } else {
                first = false;
            }
            sbuf.append(Transform.escapeHtmlTags(line));
            sbuf.append(Constants.LINE_SEPARATOR);
        }
    }

    private void appendThrowableAsHtml(final Throwable throwable, final StringBuilder sbuf) {
        final StringWriter sw = new StringWriter();
        final PrintWriter pw = new PrintWriter(sw);
        try {
            throwable.printStackTrace(pw);
        } catch (final RuntimeException ex) {
            // Ignore the exception.
        }
        pw.flush();
        final LineNumberReader reader = new LineNumberReader(new StringReader(sw.toString()));
        final ArrayList<String> lines = new ArrayList<String>();
        try {
          String line = reader.readLine();
          while (line != null) {
            lines.add(line);
            line = reader.readLine();
          }
        } catch (final IOException ex) {
            if (ex instanceof InterruptedIOException) {
                Thread.currentThread().interrupt();
            }
            lines.add(ex.toString());
        }
        boolean first = true;
        for (final String line : lines) {
            if (!first) {
                sbuf.append(TRACE_PREFIX);
            } else {
                first = false;
            }
            sbuf.append(Transform.escapeHtmlTags(line));
            sbuf.append(Constants.LINE_SEPARATOR);
        }
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private appendThrowableAsHtml(throwable Throwable, sbuf StringBuilder) : void from class org.apache.logging.log4j.core.layout.HtmlLayout


    ObjectWriter newWriter(final boolean locationInfo, final boolean properties, final boolean compact) {
        final SimpleFilterProvider filters = new SimpleFilterProvider();
        final Set<String> except = new HashSet<>(2);
        if (!locationInfo) {
            except.add(this.getPropertNameForSource());
        }
        if (!properties) {
            except.add(this.getPropertNameForContextMap());
        }
        filters.addFilter(Log4jLogEvent.class.getName(), SimpleBeanPropertyFilter.serializeAllExcept(except));
        final ObjectWriter writer = this.newObjectMapper().writer(compact ? this.newCompactPrinter() : this.newPrettyPrinter());
        return writer.with(filters);
    }

    ObjectWriter newWriter(final boolean locationInfo, final boolean properties, final boolean compact) {
        final SimpleFilterProvider filters = new SimpleFilterProvider();
        final Set<String> except = new HashSet<String>(2);
        if (!locationInfo) {
            except.add(this.getPropertNameForSource());
        }
        if (!properties) {
            except.add(this.getPropertNameForContextMap());
        }
        filters.addFilter(Log4jLogEvent.class.getName(), SimpleBeanPropertyFilter.serializeAllExcept(except));
        final ObjectWriter writer = this.newObjectMapper().writer(compact ? this.newCompactPrinter() : this.newPrettyPrinter());
        return writer.with(filters);
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method package newWriter(locationInfo boolean, properties boolean, compact boolean) : ObjectWriter from class org.apache.logging.log4j.core.layout.JacksonFactory


    @Override
    public Map<String, String> getContentFormat() {
        final Map<String, String> result = new HashMap<>();
        result.put("version", "2.0");
        return result;
    }

    @Override
    public Map<String, String> getContentFormat() {
        final Map<String, String> result = new HashMap<String, String>();
        result.put("version", "2.0");
        return result;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public getContentFormat() : Map<String,String> from class org.apache.logging.log4j.core.layout.JsonLayout