    @Test
    public void testEquals2() {
        Pair o = new Pair("first", "second");
        assertFalse((new Pair<>()).equals(o));
    }

    @Test
    public void testEquals2() {
        Pair o = new Pair("first", "second");
        assertFalse((new Pair<Object, Object>()).equals(o));
    }

Replace Generic With Diamond Pair<Object,Object> with Pair<> in method public testEquals2() : void from class org.dizitart.no2.common.tuples.PairTest


    @Test
    public void testEquals3() {
        Pair<Object, Object> pair = new Pair<>();
        assertTrue(pair.equals(new Pair()));
    }

    @Test
    public void testEquals3() {
        Pair<Object, Object> pair = new Pair<Object, Object>();
        assertTrue(pair.equals(new Pair()));
    }

Replace Generic With Diamond Pair<Object,Object> with Pair<> in method public testEquals3() : void from class org.dizitart.no2.common.tuples.PairTest


    @Test
    public void testEquals5() {
        assertFalse((new Pair<>()).equals("o"));
    }

    @Test
    public void testEquals5() {
        assertFalse((new Pair<Object, Object>()).equals("o"));
    }

Replace Generic With Diamond Pair<Object,Object> with Pair<> in method public testEquals5() : void from class org.dizitart.no2.common.tuples.PairTest


    @Test
    public void testEquals9() {
        Pair o = new Pair(null, "second");
        assertFalse((new Pair<>()).equals(o));
    }

    @Test
    public void testEquals9() {
        Pair o = new Pair(null, "second");
        assertFalse((new Pair<Object, Object>()).equals(o));
    }

Replace Generic With Diamond Pair<Object,Object> with Pair<> in method public testEquals9() : void from class org.dizitart.no2.common.tuples.PairTest


    @Test
    public void testHashCode() {
        assertEquals(6061, (new Pair<>()).hashCode());
        assertEquals(547741853, (new Pair<Object, Object>("first", "second")).hashCode());
    }

    @Test
    public void testHashCode() {
        assertEquals(6061, (new Pair<Object, Object>()).hashCode());
        assertEquals(547741853, (new Pair<Object, Object>("first", "second")).hashCode());
    }

Replace Generic With Diamond Pair<Object,Object> with Pair<> in method public testHashCode() : void from class org.dizitart.no2.common.tuples.PairTest


    @Test
    public void testSetFirst() {
        Pair<Object, Object> pair = new Pair<>();
        pair.setFirst("first");
        assertEquals("Pair(first=first, second=null)", pair.toString());
    }

    @Test
    public void testSetFirst() {
        Pair<Object, Object> pair = new Pair<Object, Object>();
        pair.setFirst("first");
        assertEquals("Pair(first=first, second=null)", pair.toString());
    }

Replace Generic With Diamond Pair<Object,Object> with Pair<> in method public testSetFirst() : void from class org.dizitart.no2.common.tuples.PairTest


    @Test
    public void testSetSecond() {
        Pair<Object, Object> pair = new Pair<>();
        pair.setSecond("second");
        assertEquals("Pair(first=null, second=second)", pair.toString());
    }

    @Test
    public void testSetSecond() {
        Pair<Object, Object> pair = new Pair<Object, Object>();
        pair.setSecond("second");
        assertEquals("Pair(first=null, second=second)", pair.toString());
    }

Replace Generic With Diamond Pair<Object,Object> with Pair<> in method public testSetSecond() : void from class org.dizitart.no2.common.tuples.PairTest


    @Test
    public void testToString() {
        assertEquals("Pair(first=null, second=null)", (new Pair<>()).toString());
    }

    @Test
    public void testToString() {
        assertEquals("Pair(first=null, second=null)", (new Pair<Object, Object>()).toString());
    }

Replace Generic With Diamond Pair<Object,Object> with Pair<> in method public testToString() : void from class org.dizitart.no2.common.tuples.PairTest


    @Test
    public void testCanEqual() {
        assertFalse((new Quartet<>()).canEqual("other"));
    }

    @Test
    public void testCanEqual() {
        assertFalse((new Quartet<Object, Object, Object, Object>()).canEqual("other"));
    }

Replace Generic With Diamond Quartet<Object,Object,Object,Object> with Quartet<> in method public testCanEqual() : void from class org.dizitart.no2.common.tuples.QuartetTest


    @Test
    public void testEquals() {
        assertFalse((new Quartet<>()).equals("o"));
    }

    @Test
    public void testEquals() {
        assertFalse((new Quartet<Object, Object, Object, Object>()).equals("o"));
    }

Replace Generic With Diamond Quartet<Object,Object,Object,Object> with Quartet<> in method public testEquals() : void from class org.dizitart.no2.common.tuples.QuartetTest


    @Test
    public void testEquals3() {
        Quartet o = new Quartet(null, "second", "third", "fourth");
        assertFalse((new Quartet<>()).equals(o));
    }

    @Test
    public void testEquals3() {
        Quartet o = new Quartet(null, "second", "third", "fourth");
        assertFalse((new Quartet<Object, Object, Object, Object>()).equals(o));
    }

Replace Generic With Diamond Quartet<Object,Object,Object,Object> with Quartet<> in method public testEquals3() : void from class org.dizitart.no2.common.tuples.QuartetTest


    @Test
    public void testEquals5() {
        Quartet<Object, Object, Object, Object> quartet = new Quartet<>();
        assertTrue(quartet.equals(new Quartet()));
    }

    @Test
    public void testEquals5() {
        Quartet<Object, Object, Object, Object> quartet = new Quartet<Object, Object, Object, Object>();
        assertTrue(quartet.equals(new Quartet()));
    }

Replace Generic With Diamond Quartet<Object,Object,Object,Object> with Quartet<> in method public testEquals5() : void from class org.dizitart.no2.common.tuples.QuartetTest


    @Test
    public void testEquals9() {
        Quartet o = new Quartet("first", "second", "third", "fourth");
        assertFalse((new Quartet<>()).equals(o));
    }

    @Test
    public void testEquals9() {
        Quartet o = new Quartet("first", "second", "third", "fourth");
        assertFalse((new Quartet<Object, Object, Object, Object>()).equals(o));
    }

Replace Generic With Diamond Quartet<Object,Object,Object,Object> with Quartet<> in method public testEquals9() : void from class org.dizitart.no2.common.tuples.QuartetTest


    @Test
    public void testHashCode() {
        assertEquals(21100921, (new Quartet<>()).hashCode());
        assertEquals(669802412,
            (new Quartet<Object, Object, Object, Object>("first", "second", "third", "fourth")).hashCode());
    }

    @Test
    public void testHashCode() {
        assertEquals(21100921, (new Quartet<Object, Object, Object, Object>()).hashCode());
        assertEquals(669802412,
            (new Quartet<Object, Object, Object, Object>("first", "second", "third", "fourth")).hashCode());
    }

Replace Generic With Diamond Quartet<Object,Object,Object,Object> with Quartet<> in method public testHashCode() : void from class org.dizitart.no2.common.tuples.QuartetTest


    @Test
    public void testSetFirst() {
        Quartet<Object, Object, Object, Object> quartet = new Quartet<>();
        quartet.setFirst("first");
        assertEquals("Quartet(first=first, second=null, third=null, fourth=null)", quartet.toString());
    }

    @Test
    public void testSetFirst() {
        Quartet<Object, Object, Object, Object> quartet = new Quartet<Object, Object, Object, Object>();
        quartet.setFirst("first");
        assertEquals("Quartet(first=first, second=null, third=null, fourth=null)", quartet.toString());
    }

Replace Generic With Diamond Quartet<Object,Object,Object,Object> with Quartet<> in method public testSetFirst() : void from class org.dizitart.no2.common.tuples.QuartetTest


    @Test
    public void testSetFourth() {
        Quartet<Object, Object, Object, Object> quartet = new Quartet<>();
        quartet.setFourth("fourth");
        assertEquals("Quartet(first=null, second=null, third=null, fourth=fourth)", quartet.toString());
    }

    @Test
    public void testSetFourth() {
        Quartet<Object, Object, Object, Object> quartet = new Quartet<Object, Object, Object, Object>();
        quartet.setFourth("fourth");
        assertEquals("Quartet(first=null, second=null, third=null, fourth=fourth)", quartet.toString());
    }

Replace Generic With Diamond Quartet<Object,Object,Object,Object> with Quartet<> in method public testSetFourth() : void from class org.dizitart.no2.common.tuples.QuartetTest


    @Test
    public void testSetSecond() {
        Quartet<Object, Object, Object, Object> quartet = new Quartet<>();
        quartet.setSecond("second");
        assertEquals("Quartet(first=null, second=second, third=null, fourth=null)", quartet.toString());
    }

    @Test
    public void testSetSecond() {
        Quartet<Object, Object, Object, Object> quartet = new Quartet<Object, Object, Object, Object>();
        quartet.setSecond("second");
        assertEquals("Quartet(first=null, second=second, third=null, fourth=null)", quartet.toString());
    }

Replace Generic With Diamond Quartet<Object,Object,Object,Object> with Quartet<> in method public testSetSecond() : void from class org.dizitart.no2.common.tuples.QuartetTest


    @Test
    public void testSetThird() {
        Quartet<Object, Object, Object, Object> quartet = new Quartet<>();
        quartet.setThird("third");
        assertEquals("Quartet(first=null, second=null, third=third, fourth=null)", quartet.toString());
    }

    @Test
    public void testSetThird() {
        Quartet<Object, Object, Object, Object> quartet = new Quartet<Object, Object, Object, Object>();
        quartet.setThird("third");
        assertEquals("Quartet(first=null, second=null, third=third, fourth=null)", quartet.toString());
    }

Replace Generic With Diamond Quartet<Object,Object,Object,Object> with Quartet<> in method public testSetThird() : void from class org.dizitart.no2.common.tuples.QuartetTest


    @Test
    public void testToString() {
        assertEquals("Quartet(first=null, second=null, third=null, fourth=null)",
            (new Quartet<>()).toString());
    }

    @Test
    public void testToString() {
        assertEquals("Quartet(first=null, second=null, third=null, fourth=null)",
            (new Quartet<Object, Object, Object, Object>()).toString());
    }

Replace Generic With Diamond Quartet<Object,Object,Object,Object> with Quartet<> in method public testToString() : void from class org.dizitart.no2.common.tuples.QuartetTest


    @Test
    public void testCanEqual() {
        assertFalse((new Quintet<>()).canEqual("other"));
    }

    @Test
    public void testCanEqual() {
        assertFalse((new Quintet<Object, Object, Object, Object, Object>()).canEqual("other"));
    }

Replace Generic With Diamond Quintet<Object,Object,Object,Object,Object> with Quintet<> in method public testCanEqual() : void from class org.dizitart.no2.common.tuples.QuintetTest


    @Test
    public void testEquals10() {
        Quintet o = new Quintet("first", "second", "third", "fourth", "fifth");
        assertFalse((new Quintet<>()).equals(o));
    }

    @Test
    public void testEquals10() {
        Quintet o = new Quintet("first", "second", "third", "fourth", "fifth");
        assertFalse((new Quintet<Object, Object, Object, Object, Object>()).equals(o));
    }

Replace Generic With Diamond Quintet<Object,Object,Object,Object,Object> with Quintet<> in method public testEquals10() : void from class org.dizitart.no2.common.tuples.QuintetTest


    @Test
    public void testEquals2() {
        assertFalse((new Quintet<>()).equals("o"));
    }

    @Test
    public void testEquals2() {
        assertFalse((new Quintet<Object, Object, Object, Object, Object>()).equals("o"));
    }

Replace Generic With Diamond Quintet<Object,Object,Object,Object,Object> with Quintet<> in method public testEquals2() : void from class org.dizitart.no2.common.tuples.QuintetTest


    @Test
    public void testEquals3() {
        Quintet o = new Quintet(null, "second", "third", "fourth", "fifth");
        assertFalse(new Quintet<>().equals(o));
    }

    @Test
    public void testEquals3() {
        Quintet o = new Quintet(null, "second", "third", "fourth", "fifth");
        assertFalse((new Quintet<Object, Object, Object, Object, Object>()).equals(o));
    }

Replace Generic With Diamond Quintet<Object,Object,Object,Object,Object> with Quintet<> in method public testEquals3() : void from class org.dizitart.no2.common.tuples.QuintetTest


    @Test
    public void testEquals6() {
        Quintet<Object, Object, Object, Object, Object> quintet = new Quintet<>();
        assertTrue(quintet.equals(new Quintet()));
    }

    @Test
    public void testEquals6() {
        Quintet<Object, Object, Object, Object, Object> quintet = new Quintet<Object, Object, Object, Object, Object>();
        assertTrue(quintet.equals(new Quintet()));
    }

Replace Generic With Diamond Quintet<Object,Object,Object,Object,Object> with Quintet<> in method public testEquals6() : void from class org.dizitart.no2.common.tuples.QuintetTest


    @Test
    public void testHashCode() {
        assertEquals(961065563,
            (new Quintet<Object, Object, Object, Object, Object>("first", "second", "third", "fourth", "fifth"))
                .hashCode());
        assertEquals(1244954382, (new Quintet<>()).hashCode());
    }

    @Test
    public void testHashCode() {
        assertEquals(961065563,
            (new Quintet<Object, Object, Object, Object, Object>("first", "second", "third", "fourth", "fifth"))
                .hashCode());
        assertEquals(1244954382, (new Quintet<Object, Object, Object, Object, Object>()).hashCode());
    }

Replace Generic With Diamond Quintet<Object,Object,Object,Object,Object> with Quintet<> in method public testHashCode() : void from class org.dizitart.no2.common.tuples.QuintetTest


    @Test
    public void testSetFifth() {
        Quintet<Object, Object, Object, Object, Object> quintet = new Quintet<>();
        quintet.setFifth("fifth");
        assertEquals("Quintet(first=null, second=null, third=null, fourth=null, fifth=fifth)", quintet.toString());
    }

    @Test
    public void testSetFifth() {
        Quintet<Object, Object, Object, Object, Object> quintet = new Quintet<Object, Object, Object, Object, Object>();
        quintet.setFifth("fifth");
        assertEquals("Quintet(first=null, second=null, third=null, fourth=null, fifth=fifth)", quintet.toString());
    }

Replace Generic With Diamond Quintet<Object,Object,Object,Object,Object> with Quintet<> in method public testSetFifth() : void from class org.dizitart.no2.common.tuples.QuintetTest


    @Test
    public void testSetFirst() {
        Quintet<Object, Object, Object, Object, Object> quintet = new Quintet<>();
        quintet.setFirst("first");
        assertEquals("Quintet(first=first, second=null, third=null, fourth=null, fifth=null)", quintet.toString());
    }

    @Test
    public void testSetFirst() {
        Quintet<Object, Object, Object, Object, Object> quintet = new Quintet<Object, Object, Object, Object, Object>();
        quintet.setFirst("first");
        assertEquals("Quintet(first=first, second=null, third=null, fourth=null, fifth=null)", quintet.toString());
    }

Replace Generic With Diamond Quintet<Object,Object,Object,Object,Object> with Quintet<> in method public testSetFirst() : void from class org.dizitart.no2.common.tuples.QuintetTest


    @Test
    public void testSetFourth() {
        Quintet<Object, Object, Object, Object, Object> quintet = new Quintet<>();
        quintet.setFourth("fourth");
        assertEquals("Quintet(first=null, second=null, third=null, fourth=fourth, fifth=null)", quintet.toString());
    }

    @Test
    public void testSetFourth() {
        Quintet<Object, Object, Object, Object, Object> quintet = new Quintet<Object, Object, Object, Object, Object>();
        quintet.setFourth("fourth");
        assertEquals("Quintet(first=null, second=null, third=null, fourth=fourth, fifth=null)", quintet.toString());
    }

Replace Generic With Diamond Quintet<Object,Object,Object,Object,Object> with Quintet<> in method public testSetFourth() : void from class org.dizitart.no2.common.tuples.QuintetTest


    @Test
    public void testSetSecond() {
        Quintet<Object, Object, Object, Object, Object> quintet = new Quintet<>();
        quintet.setSecond("second");
        assertEquals("Quintet(first=null, second=second, third=null, fourth=null, fifth=null)", quintet.toString());
    }

    @Test
    public void testSetSecond() {
        Quintet<Object, Object, Object, Object, Object> quintet = new Quintet<Object, Object, Object, Object, Object>();
        quintet.setSecond("second");
        assertEquals("Quintet(first=null, second=second, third=null, fourth=null, fifth=null)", quintet.toString());
    }

Replace Generic With Diamond Quintet<Object,Object,Object,Object,Object> with Quintet<> in method public testSetSecond() : void from class org.dizitart.no2.common.tuples.QuintetTest


    @Test
    public void testSetThird() {
        Quintet<Object, Object, Object, Object, Object> quintet = new Quintet<>();
        quintet.setThird("third");
        assertEquals("Quintet(first=null, second=null, third=third, fourth=null, fifth=null)", quintet.toString());
    }

    @Test
    public void testSetThird() {
        Quintet<Object, Object, Object, Object, Object> quintet = new Quintet<Object, Object, Object, Object, Object>();
        quintet.setThird("third");
        assertEquals("Quintet(first=null, second=null, third=third, fourth=null, fifth=null)", quintet.toString());
    }

Replace Generic With Diamond Quintet<Object,Object,Object,Object,Object> with Quintet<> in method public testSetThird() : void from class org.dizitart.no2.common.tuples.QuintetTest


    @Test
    public void testToString() {
        assertEquals("Quintet(first=null, second=null, third=null, fourth=null, fifth=null)",
            (new Quintet<>()).toString());
    }

    @Test
    public void testToString() {
        assertEquals("Quintet(first=null, second=null, third=null, fourth=null, fifth=null)",
            (new Quintet<Object, Object, Object, Object, Object>()).toString());
    }

Replace Generic With Diamond Quintet<Object,Object,Object,Object,Object> with Quintet<> in method public testToString() : void from class org.dizitart.no2.common.tuples.QuintetTest


    @Test
    public void testCanEqual() {
        assertFalse((new Triplet<>()).canEqual("other"));
    }

    @Test
    public void testCanEqual() {
        assertFalse((new Triplet<Object, Object, Object>()).canEqual("other"));
    }

Replace Generic With Diamond Triplet<Object,Object,Object> with Triplet<> in method public testCanEqual() : void from class org.dizitart.no2.common.tuples.TripletTest


    @Test
    public void testEquals2() {
        Triplet o = new Triplet("first", "second", "third");
        assertFalse((new Triplet<>()).equals(o));
    }

    @Test
    public void testEquals2() {
        Triplet o = new Triplet("first", "second", "third");
        assertFalse((new Triplet<Object, Object, Object>()).equals(o));
    }

Replace Generic With Diamond Triplet<Object,Object,Object> with Triplet<> in method public testEquals2() : void from class org.dizitart.no2.common.tuples.TripletTest


    @Test
    public void testEquals3() {
        Triplet o = new Triplet(null, "second", "third");
        assertFalse((new Triplet<>()).equals(o));
    }

    @Test
    public void testEquals3() {
        Triplet o = new Triplet(null, "second", "third");
        assertFalse((new Triplet<Object, Object, Object>()).equals(o));
    }

Replace Generic With Diamond Triplet<Object,Object,Object> with Triplet<> in method public testEquals3() : void from class org.dizitart.no2.common.tuples.TripletTest


    @Test
    public void testEquals5() {
        assertFalse((new Triplet<>()).equals("o"));
    }

    @Test
    public void testEquals5() {
        assertFalse((new Triplet<Object, Object, Object>()).equals("o"));
    }

Replace Generic With Diamond Triplet<Object,Object,Object> with Triplet<> in method public testEquals5() : void from class org.dizitart.no2.common.tuples.TripletTest


    @Test
    public void testEquals6() {
        Triplet<Object, Object, Object> triplet = new Triplet<>();
        assertTrue(triplet.equals(new Triplet()));
    }

    @Test
    public void testEquals6() {
        Triplet<Object, Object, Object> triplet = new Triplet<Object, Object, Object>();
        assertTrue(triplet.equals(new Triplet()));
    }

Replace Generic With Diamond Triplet<Object,Object,Object> with Triplet<> in method public testEquals6() : void from class org.dizitart.no2.common.tuples.TripletTest


    @Test
    public void testHashCode() {
        assertEquals(-1932637802, (new Triplet<Object, Object, Object>("first", "second", "third")).hashCode());
        assertEquals(357642, (new Triplet<>()).hashCode());
    }

    @Test
    public void testHashCode() {
        assertEquals(-1932637802, (new Triplet<Object, Object, Object>("first", "second", "third")).hashCode());
        assertEquals(357642, (new Triplet<Object, Object, Object>()).hashCode());
    }

Replace Generic With Diamond Triplet<Object,Object,Object> with Triplet<> in method public testHashCode() : void from class org.dizitart.no2.common.tuples.TripletTest


    @Test
    public void testSetFirst() {
        Triplet<Object, Object, Object> triplet = new Triplet<>();
        triplet.setFirst("first");
        assertEquals("Triplet(first=first, second=null, third=null)", triplet.toString());
    }

    @Test
    public void testSetFirst() {
        Triplet<Object, Object, Object> triplet = new Triplet<Object, Object, Object>();
        triplet.setFirst("first");
        assertEquals("Triplet(first=first, second=null, third=null)", triplet.toString());
    }

Replace Generic With Diamond Triplet<Object,Object,Object> with Triplet<> in method public testSetFirst() : void from class org.dizitart.no2.common.tuples.TripletTest


    @Test
    public void testSetSecond() {
        Triplet<Object, Object, Object> triplet = new Triplet<>();
        triplet.setSecond("second");
        assertEquals("Triplet(first=null, second=second, third=null)", triplet.toString());
    }

    @Test
    public void testSetSecond() {
        Triplet<Object, Object, Object> triplet = new Triplet<Object, Object, Object>();
        triplet.setSecond("second");
        assertEquals("Triplet(first=null, second=second, third=null)", triplet.toString());
    }

Replace Generic With Diamond Triplet<Object,Object,Object> with Triplet<> in method public testSetSecond() : void from class org.dizitart.no2.common.tuples.TripletTest


    @Test
    public void testSetThird() {
        Triplet<Object, Object, Object> triplet = new Triplet<>();
        triplet.setThird("third");
        assertEquals("Triplet(first=null, second=null, third=third)", triplet.toString());
    }

    @Test
    public void testSetThird() {
        Triplet<Object, Object, Object> triplet = new Triplet<Object, Object, Object>();
        triplet.setThird("third");
        assertEquals("Triplet(first=null, second=null, third=third)", triplet.toString());
    }

Replace Generic With Diamond Triplet<Object,Object,Object> with Triplet<> in method public testSetThird() : void from class org.dizitart.no2.common.tuples.TripletTest


    @Test
    public void testToString() {
        assertEquals("Triplet(first=null, second=null, third=null)", (new Triplet<>()).toString());
    }

    @Test
    public void testToString() {
        assertEquals("Triplet(first=null, second=null, third=null)", (new Triplet<Object, Object, Object>()).toString());
    }

Replace Generic With Diamond Triplet<Object,Object,Object> with Triplet<> in method public testToString() : void from class org.dizitart.no2.common.tuples.TripletTest


    /**
     * Read the summary information of the file and write them to system out.
     *
     * @param fileName the name of the file.
     * @param writer   the print writer.
     * @return null if successful (if there was no error), otherwise the error message
     */
    private static String info(String fileName, Writer writer) {
        PrintWriter pw = new PrintWriter(writer, true);
        if (!FilePath.get(fileName).exists()) {
            pw.println("File not found: " + fileName);
            return "File not found: " + fileName;
        }
        long fileLength = FileUtils.size(fileName);
        try (MVStore store = new MVStore.Builder().
            fileName(fileName).
            readOnly().open()) {
            MVMap<String, String> meta = store.getMetaMap();
            Map<String, Object> header = store.getStoreHeader();
            long fileCreated = DataUtils.readHexLong(header, "created", 0L);
            TreeMap<Integer, Chunk> chunks = new TreeMap<>();
            long chunkLength = 0;
            long maxLength = 0;
            long maxLengthLive = 0;
            long maxLengthNotEmpty = 0;
            for (Map.Entry<String, String> e : meta.entrySet()) {
                String k = e.getKey();
                if (k.startsWith("chunk.")) {
                    Chunk c = Chunk.fromString(e.getValue());
                    chunks.put(c.id, c);
                    chunkLength += (long) c.len * BLOCK_SIZE;
                    maxLength += c.maxLen;
                    maxLengthLive += c.maxLenLive;
                    if (c.maxLenLive > 0) {
                        maxLengthNotEmpty += c.maxLen;
                    }
                }
            }
            pw.printf("Created: %s\n", formatTimestamp(fileCreated, fileCreated));
            pw.printf("Last modified: %s\n",
                formatTimestamp(FileUtils.lastModified(fileName), fileCreated));
            pw.printf("File length: %d\n", fileLength);
            pw.printf("The last chunk is not listed\n");
            pw.printf("Chunk length: %d\n", chunkLength);
            pw.printf("Chunk count: %d\n", chunks.size());
            pw.printf("Used space: %d%%\n", getPercent(chunkLength, fileLength));
            pw.printf("Chunk fill rate: %d%%\n", maxLength == 0 ? 100 :
                getPercent(maxLengthLive, maxLength));
            pw.printf("Chunk fill rate excluding empty chunks: %d%%\n",
                maxLengthNotEmpty == 0 ? 100 :
                    getPercent(maxLengthLive, maxLengthNotEmpty));
            for (Map.Entry<Integer, Chunk> e : chunks.entrySet()) {
                Chunk c = e.getValue();
                long created = fileCreated + c.time;
                pw.printf("  Chunk %d: %s, %d%% used, %d blocks",
                    c.id, formatTimestamp(created, fileCreated),
                    getPercent(c.maxLenLive, c.maxLen),
                    c.len
                );
                if (c.maxLenLive == 0) {
                    pw.printf(", unused: %s",
                        formatTimestamp(fileCreated + c.unused, fileCreated));
                }
                pw.printf("\n");
            }
            pw.printf("\n");
        } catch (Exception e) {
            pw.println("ERROR: " + e);
            e.printStackTrace(pw);
            return e.getMessage();
        }
        pw.flush();
        return null;
    }

    /**
     * Read the summary information of the file and write them to system out.
     *
     * @param fileName the name of the file.
     * @param writer   the print writer.
     * @return null if successful (if there was no error), otherwise the error message
     */
    private static String info(String fileName, Writer writer) {
        PrintWriter pw = new PrintWriter(writer, true);
        if (!FilePath.get(fileName).exists()) {
            pw.println("File not found: " + fileName);
            return "File not found: " + fileName;
        }
        long fileLength = FileUtils.size(fileName);
        MVStore store = new MVStore.Builder().
            fileName(fileName).
            readOnly().open();
        try {
            MVMap<String, String> meta = store.getMetaMap();
            Map<String, Object> header = store.getStoreHeader();
            long fileCreated = DataUtils.readHexLong(header, "created", 0L);
            TreeMap<Integer, Chunk> chunks = new TreeMap<>();
            long chunkLength = 0;
            long maxLength = 0;
            long maxLengthLive = 0;
            long maxLengthNotEmpty = 0;
            for (Map.Entry<String, String> e : meta.entrySet()) {
                String k = e.getKey();
                if (k.startsWith("chunk.")) {
                    Chunk c = Chunk.fromString(e.getValue());
                    chunks.put(c.id, c);
                    chunkLength += (long) c.len * BLOCK_SIZE;
                    maxLength += c.maxLen;
                    maxLengthLive += c.maxLenLive;
                    if (c.maxLenLive > 0) {
                        maxLengthNotEmpty += c.maxLen;
                    }
                }
            }
            pw.printf("Created: %s\n", formatTimestamp(fileCreated, fileCreated));
            pw.printf("Last modified: %s\n",
                formatTimestamp(FileUtils.lastModified(fileName), fileCreated));
            pw.printf("File length: %d\n", fileLength);
            pw.printf("The last chunk is not listed\n");
            pw.printf("Chunk length: %d\n", chunkLength);
            pw.printf("Chunk count: %d\n", chunks.size());
            pw.printf("Used space: %d%%\n", getPercent(chunkLength, fileLength));
            pw.printf("Chunk fill rate: %d%%\n", maxLength == 0 ? 100 :
                getPercent(maxLengthLive, maxLength));
            pw.printf("Chunk fill rate excluding empty chunks: %d%%\n",
                maxLengthNotEmpty == 0 ? 100 :
                    getPercent(maxLengthLive, maxLengthNotEmpty));
            for (Map.Entry<Integer, Chunk> e : chunks.entrySet()) {
                Chunk c = e.getValue();
                long created = fileCreated + c.time;
                pw.printf("  Chunk %d: %s, %d%% used, %d blocks",
                    c.id, formatTimestamp(created, fileCreated),
                    getPercent(c.maxLenLive, c.maxLen),
                    c.len
                );
                if (c.maxLenLive == 0) {
                    pw.printf(", unused: %s",
                        formatTimestamp(fileCreated + c.unused, fileCreated));
                }
                pw.printf("\n");
            }
            pw.printf("\n");
        } catch (Exception e) {
            pw.println("ERROR: " + e);
            e.printStackTrace(pw);
            return e.getMessage();
        } finally {
            store.close();
        }
        pw.flush();
        return null;
    }

Try With Resources try(MVStore store=new MVStore.Builder().fileName(fileName).readOnly().open()) in method private info(fileName String, writer Writer) : String from class org.dizitart.no2.mvstore.Recovery


    @Override
    public RecordStream<V> values() {
        return RecordStream.fromIterable(new ValueSet<>(rocksDB, columnFamilyHandle, marshaller));
    }

    @Override
    public RecordStream<V> values() {
        return RecordStream.fromIterable(new ValueSet<V>(db, this, configuration));
    }

Replace Generic With Diamond ValueSet<V> with ValueSet<> in method public values() : RecordStream<V> from class org.dizitart.no2.rocksdb.RocksDBMap


    @Override
    public RecordStream<K> keySet() {
        return RecordStream.fromIterable(new KeySet<>(rocksDB, columnFamilyHandle, marshaller));
    }

    @Override
    public RecordStream<K> keySet() {
        return RecordStream.fromIterable(new KeySet<K>(db, this, configuration));
    }

Replace Generic With Diamond KeySet<K> with KeySet<> in method public keySet() : RecordStream<K> from class org.dizitart.no2.rocksdb.RocksDBMap


    @Override
    public RecordStream<KeyValuePair<K, V>> entries() {
        return RecordStream.fromIterable(new EntrySet<>(rocksDB, columnFamilyHandle, marshaller));
    }

    @Override
    public RecordStream<KeyValuePair<K, V>> entries() {
        return RecordStream.fromIterable(new EntrySet<K, V>(db, this, configuration));
    }

Replace Generic With Diamond EntrySet<K,V> with EntrySet<> in method public entries() : RecordStream<KeyValuePair<K,V>> from class org.dizitart.no2.rocksdb.RocksDBMap


    @Test
    public void testOperations() throws InterruptedException {
        NitriteBuilder builder = NitriteBuilder.get()
            .compressed();

        if (!inMemory) {
            builder.filePath(fileName);
        }

        Nitrite db = builder.openOrCreate();

        collection = db.getCollection("test");
        collection.remove(Filter.ALL);
        collection.createIndex("unixTime", IndexOptions.indexOptions(IndexType.Unique));
        db.commit();

        for (int i = 0; i < threadCount; i++) {
            executor.submit(() -> {
                for (int j = 0; j < iterationCount; j++) {
                    try {
                        Document document = generate();
                        collection.insert(document);

                        if (j == iterationCount / 2
                            && !collection.hasIndex("text")
                            && !collection.hasIndex("date")) {
                            collection.createIndex("text", IndexOptions.indexOptions(IndexType.Fulltext));
                            collection.createIndex("date", IndexOptions.indexOptions(IndexType.NonUnique));
                        }

                        long unixTime = (long) document.get("unixTime");
                        DocumentCursor cursor = collection.find(where("unixTime").eq(unixTime));
                        assertTrue(cursor.size() >= 0);

                        if (collection.hasIndex("text") && !collection.isIndexing("text")) {
                            String textData = (String) document.get("text");
                            cursor = collection.find(where("text").text(textData));
                            assertTrue(cursor.size() >= 0);
                        }

                        assertTrue(collection.hasIndex("unixTime"));
                    } catch (Throwable e) {
                        System.out.println("Exception at thread " +
                            Thread.currentThread().getName() + " with iteration " + j);
                        e.printStackTrace();
                    }
                }
                latch.countDown();
            });
        }

        latch.await();

        db.commit();

        assertTrue(collection.hasIndex("text"));
        assertTrue(collection.hasIndex("date"));

        DocumentCursor cursor = collection.find();
        assertEquals(cursor.size(), docCounter.get());

        cursor = collection.find(where("unixTime").gt(1));
        assertEquals(cursor.size(), docCounter.get());

        db.close();
    }

    @Test
    public void testOperations() throws InterruptedException {
        NitriteBuilder builder = new NitriteBuilder()
                .compressed();

        if (!inMemory) {
            builder.filePath(fileName);
        }

        if (externalTextIndexer) {
            builder.textIndexingService(new LuceneService());
        }

        Nitrite db = builder.openOrCreate();

        collection = db.getCollection("test");
        collection.remove(ALL);
        collection.createIndex("unixTime", IndexOptions.indexOptions(IndexType.Unique));
        db.commit();

        for (int i = 0; i < threadCount; i++) {
            executor.submit(new Runnable() {
                @Override
                public void run() {
                    for (int j = 0; j < iterationCount; j++) {
                        try {
                            Document document = generate();
                            collection.insert(document);

                            if (j == iterationCount / 2
                                    && !collection.hasIndex("text")
                                    && !collection.hasIndex("date")) {
                                collection.createIndex("text", IndexOptions.indexOptions(IndexType.Fulltext));
                                collection.createIndex("date", IndexOptions.indexOptions(IndexType.NonUnique));
                            }

                            long unixTime = (long) document.get("unixTime");
                            Cursor cursor = collection.find(eq("unixTime", unixTime));
                            assertTrue(cursor.size() >= 0);

                            if (collection.hasIndex("text") && !collection.isIndexing("text")) {
                                String textData = (String) document.get("text");
                                cursor = collection.find(text("text", textData));
                                assertTrue(cursor.size() >= 0);
                            }

                            assertTrue(collection.hasIndex("unixTime"));
                        } catch (Throwable e) {
                            System.out.println("Exception at thread " +
                                    Thread.currentThread().getName() + " with iteration " + j);
                            e.printStackTrace();
                        }
                    }
                    latch.countDown();
                }
            });
        }

        latch.await();

        db.commit();

        assertTrue(collection.hasIndex("text"));
        assertTrue(collection.hasIndex("date"));

        Cursor cursor = collection.find();
        assertEquals(cursor.size(), docCounter.get());

        cursor = collection.find(gt("unixTime", 1));
        assertEquals(cursor.size(), docCounter.get());

        db.close();
    }

Replace Anonymous With Lambda org.dizitart.no2.MultiThreadedTest.testOperations.submit.new Runnable with () -> {for(int j=0; j < iterationCount; j++){tryDocument document=generate(); in method public testOperations() : void from class org.dizitart.no2.MultiThreadedTest


    @Test
    public void testIssue185() throws InterruptedException {
        final ObjectRepository<Receipt> repository = db.getRepository(Receipt.class);
        final Receipt receipt = new Receipt();
        receipt.clientRef = "111-11111";
        receipt.status = Receipt.Status.PREPARING;
        CountDownLatch latch = new CountDownLatch(1);

        new Thread(() -> {
            for (int i = 0; i < 1000; ++i) {
                try {
                    repository.update(receipt, true);
                    try {
                        Thread.sleep(50);
                    } catch (InterruptedException ignored) {
                    }
                    repository.remove(receipt);
                    try {
                        Thread.sleep(50);
                    } catch (InterruptedException ignored) {
                    }
                } catch (Throwable t) {
                    t.printStackTrace();
                }
            }
            latch.countDown();
        }).start();

        for (int i = 0; i < 1000; ++i) {
            repository.find(where("status").eq(Receipt.Status.COMPLETED).not())
                .sort("createdTimestamp", SortOrder.Descending).toList();
            try {
                Thread.sleep(50);
            } catch (InterruptedException ignored) {
            }
        }
        latch.await();
    }

    @Test
    public void testIssue185() throws InterruptedException {
        final ObjectRepository<Receipt> repository = db.getRepository(Receipt.class);
        final Receipt receipt = new Receipt();
        receipt.clientRef = "111-11111";
        receipt.status = Receipt.Status.PREPARING;
        final CountDownLatch latch = new CountDownLatch(1);

        new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 1000; ++i) {
                    try {
                        repository.update(receipt, true);
                        try {
                            Thread.sleep(50);
                        } catch (InterruptedException ignored) {
                        }
                        repository.remove(receipt);
                        try {
                            Thread.sleep(50);
                        } catch (InterruptedException ignored) {
                        }
                    } catch (Throwable t) {
                        t.printStackTrace();
                    }
                }
                latch.countDown();
            }
        }).start();

        for (int i = 0; i < 1000; ++i) {
            repository.find(not(eq("status", Receipt.Status.COMPLETED)), FindOptions.sort("createdTimestamp", SortOrder.Descending)).toList();
            try {
                Thread.sleep(50);
            } catch (InterruptedException ignored) {
            }
        }
        latch.await();
    }

Replace Anonymous With Lambda org.dizitart.no2.NitriteTest.testIssue185.start.new Thread.new Runnable with () -> {for(int i=0; i < 1000; ++i){tryrepository.update(receipt,true); in method public testIssue185() : void from class org.dizitart.no2.NitriteTest


    @Test
    public void testIssue193() throws InterruptedException {
        final ObjectRepository<Receipt> repository = db.getRepository(Receipt.class);
        final PodamFactory factory = new PodamFactoryImpl();
        final String[] refs = new String[]{"1", "2", "3", "4", "5"};
        final Random random = new Random();
        ExecutorService pool = ThreadPoolManager.workerPool();

        final CountDownLatch latch = new CountDownLatch(10000);
        for (int i = 0; i < 10000; i++) {
            pool.submit(() -> {
                int refIndex = random.nextInt(5);
                Receipt receipt = factory.manufacturePojoWithFullData(Receipt.class);
                receipt.setClientRef(refs[refIndex]);
                repository.update(receipt, true);
                latch.countDown();
            });
        }

        latch.await();
        assertTrue(repository.find().size() <= 5);
        pool.shutdown();
    }

    @Test
    public void testIssue193() throws InterruptedException {
        final ObjectRepository<Receipt> repository = db.getRepository(Receipt.class);
        final PodamFactory factory = new PodamFactoryImpl();
        final String[] refs = new String[] {"1", "2", "3", "4", "5"};
        final Random random = new Random();
        ExecutorService pool = Executors.newCachedThreadPool();

        final CountDownLatch latch = new CountDownLatch(10000);
        for (int i = 0; i < 10000; i++) {
            pool.submit(new Runnable() {
                @Override
                public void run() {
                    int refIndex = random.nextInt(5);
                    Receipt receipt = factory.manufacturePojoWithFullData(Receipt.class);
                    receipt.setClientRef(refs[refIndex]);
                    repository.update(receipt, true);
                    latch.countDown();
                }
            });
        }

        latch.await();
        assertTrue(repository.find().size() <= 5);
    }

Replace Anonymous With Lambda org.dizitart.no2.NitriteTest.testIssue193.submit.new Runnable with () -> {int refIndex=random.nextInt(5); in method public testIssue193() : void from class org.dizitart.no2.NitriteTest


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        progressBar = findViewById(R.id.progressBar);
        ListView userList = findViewById(R.id.userlist);
        adapter = new UserAdapter(this);
        userList.setAdapter(adapter);

        if (db == null) {
            progressBar.setVisibility(View.VISIBLE);
            String fileName = getFilesDir().getPath() + "/test.db";
            Log.i("Nitrite", "Nitrite file - " + fileName);
            db = NitriteBuilder.get()
                .filePath(fileName)
                .openOrCreate("test-user", "test-password");
            repository = db.getRepository(User.class);

            listener = changeInfo -> {
                Iterable<User> users = repository.find().project(User.class);
                adapter.setUsers(Iterables.toList(users));
                adapter.notifyDataSetChanged();
            };

            repository.subscribe(listener);
            progressBar.setVisibility(View.INVISIBLE);
            getUsers();
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        progressBar = (ProgressBar) findViewById(R.id.progressBar);
        ListView userList = (ListView) findViewById(R.id.userlist);
        adapter = new UserAdapter(this);
        userList.setAdapter(adapter);

        if (db == null) {
            progressBar.setVisibility(View.VISIBLE);
            String fileName = getFilesDir().getPath() + "/test.db";
            Log.i("Nitrite", "Nitrite file - " + fileName);
            db = Nitrite.builder()
                    .filePath(fileName)
                    .openOrCreate("test-user", "test-password");
            repository = db.getRepository(User.class);

            listener = new ChangeListener() {
                @Override
                public void onChange(ChangeInfo changeInfo) {
                    Iterable<User> users = repository.find().project(User.class);
                    adapter.setUsers(Iterables.toList(users));
                    adapter.notifyDataSetChanged();
                }
            };

            repository.register(listener);
            progressBar.setVisibility(View.INVISIBLE);
            getUsers();
        }
    }

Replace Anonymous With Lambda org.dizitart.no2.sample.android.MainActivity.onCreate.new ChangeListener with changeInfo -> {Iterable<User> users=repository.find().project(User.class); in method protected onCreate(savedInstanceState Bundle) : void from class org.dizitart.no2.example.android.MainActivity


    public static Note randomNote() {
        InputStream inputStream = ClassLoader.getSystemResourceAsStream("test.text");

        try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
            String strLine;
            long line = random.nextInt(49);
            int count = 0;
            while ((strLine = br.readLine()) != null) {
                if (count == line) {
                    Note note = new Note();
                    note.setNoteId(line);
                    note.setText(strLine);
                    return note;
                }
                count++;
            }
        } catch (IOException e) {
            // ignore
        }
        // ignore
        return null;
    }

    private static Note randomNote() {
        InputStream inputStream = ClassLoader.getSystemResourceAsStream("note.text");
        BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));

        String strLine;
        int line = random.nextInt(49);
        int count = 0;
        try {
            while ((strLine = br.readLine()) != null) {
                if (count == line) {
                    Note note = new Note();
                    note.setNoteId(line);
                    note.setText(strLine);
                    return note;
                }
                count++;
            }
        } catch (IOException e) {
            // ignore
        } finally {
            try {
                br.close();
            } catch (IOException e) {
                // ignore
            }
        }
        return null;
    }

Try With Resources try(BufferedReader br=new BufferedReader(new InputStreamReader(inputStream))) in method public randomNote() : Note from class org.dizitart.no2.support.DataGenerator


    public static Note randomNote() {
        InputStream inputStream = ClassLoader.getSystemResourceAsStream("test.text");

        assert inputStream != null;
        try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
            String strLine;
            long line = random.nextInt(49);
            int count = 0;
            while ((strLine = br.readLine()) != null) {
                if (count == line) {
                    Note note = new Note();
                    note.setNoteId(line);
                    note.setText(strLine);
                    return note;
                }
                count++;
            }
        } catch (IOException e) {
            // ignore
        }
        // ignore
        return null;
    }

    private static Note randomNote() {
        InputStream inputStream = ClassLoader.getSystemResourceAsStream("test.text");
        BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));

        String strLine;
        long line = random.nextInt(49);
        int count = 0;
        try {
            while ((strLine = br.readLine()) != null) {
                if (count == line) {
                    Note note = new Note();
                    note.setNoteId(line);
                    note.setText(strLine);
                    return note;
                }
                count++;
            }
        } catch (IOException e) {
            // ignore
        } finally {
            try {
                br.close();
            } catch (IOException e) {
                // ignore
            }
        }
        return null;
    }

Try With Resources try(BufferedReader br=new BufferedReader(new InputStreamReader(inputStream))) in method public randomNote() : Note from class org.dizitart.no2.repository.data.DataGenerator


    private static String randomCompanyName() {
        InputStream inputStream = ClassLoader.getSystemResourceAsStream("english.stop");

        assert inputStream != null;
        try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
            String strLine;
            int line = random.nextInt(570);
            int count = 0;
            while ((strLine = br.readLine()) != null) {
                if (count == line) {
                    return strLine + System.nanoTime() + " inc.";
                }
                count++;
            }
        } catch (IOException e) {
            // ignore
        }
        // ignore
        return null;
    }

    private static String randomCompanyName() {
        InputStream inputStream = ClassLoader.getSystemResourceAsStream("english.stop");
        BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));

        String strLine;
        int line = counter.incrementAndGet();
        int count = 0;
        try {
            while ((strLine = br.readLine()) != null) {
                if (count == line) {
                    return strLine + " inc.";
                }
                count++;
            }
        } catch (IOException e) {
            // ignore
        } finally {
            try {
                br.close();
            } catch (IOException e) {
                // ignore
            }
        }
        return null;
    }

Try With Resources try(BufferedReader br=new BufferedReader(new InputStreamReader(inputStream))) in method private randomCompanyName() : String from class org.dizitart.no2.repository.data.DataGenerator


    private Callable<Boolean> bodyIndexingCompleted() {
        return () -> !collection.isIndexing("body");
    }

    private Callable<Boolean> bodyIndexingCompleted() {
        return new Callable<Boolean>() {
            public Boolean call() throws Exception {
                return !collection.isIndexing("body");
            }
        };
    }

Replace Anonymous With Lambda org.dizitart.no2.CollectionIndexTest.bodyIndexingCompleted.new Callable<Boolean> with () -> !collection.isIndexing("body") in method private bodyIndexingCompleted() : Callable<Boolean> from class org.dizitart.no2.collection.CollectionIndexTest


    @Test
    public void testRebuildIndex() {
        companyRepository.createIndex("dateCreated", IndexOptions.indexOptions(IndexType.NonUnique));
        assertFalse(companyRepository.isIndexing("dateCreated"));

        companyRepository.rebuildIndex("dateCreated", true);
        assertTrue(companyRepository.isIndexing("dateCreated"));

        await().until(() -> !companyRepository.isIndexing("dateCreated"));
    }

    @Test
    public void testRebuildIndex() {
        companyRepository.createIndex("dateCreated", IndexOptions.indexOptions(IndexType.NonUnique));
        assertFalse(companyRepository.isIndexing("dateCreated"));

        companyRepository.rebuildIndex("dateCreated", true);
        assertTrue(companyRepository.isIndexing("dateCreated"));

        await().until(new Callable<Boolean>() {
            @Override
            public Boolean call() throws Exception {
                return !companyRepository.isIndexing("dateCreated");
            }
        });
    }

Replace Anonymous With Lambda org.dizitart.no2.objects.RepositoryModificationTest.testRebuildIndex.until.new Callable<Boolean> with () -> !companyRepository.isIndexing("dateCreated") in method public testRebuildIndex() : void from class org.dizitart.no2.repository.RepositoryModificationTest


    /**
     * Imports data from a file.
     *
     * @param file the file
     * @throws NitriteIOException  if there is any low-level I/O error.
     */
    public void importFrom(File file) {

        try(FileInputStream stream = new FileInputStream(file);) {
            importFrom(stream);
        } catch (IOException ioe) {
            throw new NitriteIOException(
                    errorMessage("I/O error while reading content from file " + file,
                            NIOE_IMPORT_ERROR), ioe);
        }
    }

    /**
     * Imports data from a file.
     *
     * @param file the file
     * @throws NitriteIOException  if there is any low-level I/O error.
     */
    public void importFrom(File file) {
        try {
            importFrom(new FileInputStream(file));
        } catch (IOException ioe) {
            throw new NitriteIOException(
                    errorMessage("I/O error while reading content from file " + file,
                            NIOE_IMPORT_ERROR), ioe);
        }
    }

Try With Resources try(FileInputStream stream=new FileInputStream(file)) in method public importFrom(file File) : void from class org.dizitart.no2.tool.Importer


    /**
     * Read the summary information of the file and write them to system out.
     *
     * @param fileName the name of the file.
     * @param writer the print writer.
     * @return null if successful (if there was no error), otherwise the error message
     */
    private static String info(String fileName, Writer writer) {
        PrintWriter pw = new PrintWriter(writer, true);
        if (!FilePath.get(fileName).exists()) {
            pw.println("File not found: " + fileName);
            return "File not found: " + fileName;
        }
        long fileLength = FileUtils.size(fileName);
        MVStore store = new MVStore.Builder().
                fileName(fileName).
                readOnly().open();
        try {
            MVMap<String, String> meta = store.getMetaMap();
            Map<String, Object> header = store.getStoreHeader();
            long fileCreated = DataUtils.readHexLong(header, "created", 0L);
            TreeMap<Integer, Chunk> chunks = new TreeMap<>();
            long chunkLength = 0;
            long maxLength = 0;
            long maxLengthLive = 0;
            long maxLengthNotEmpty = 0;
            for (Map.Entry<String, String> e : meta.entrySet()) {
                String k = e.getKey();
                if (k.startsWith("chunk.")) {
                    Chunk c = Chunk.fromString(e.getValue());
                    chunks.put(c.id, c);
                    chunkLength += c.len * BLOCK_SIZE;
                    maxLength += c.maxLen;
                    maxLengthLive += c.maxLenLive;
                    if (c.maxLenLive > 0) {
                        maxLengthNotEmpty += c.maxLen;
                    }
                }
            }
            pw.printf("Created: %s\n", formatTimestamp(fileCreated, fileCreated));
            pw.printf("Last modified: %s\n",
                    formatTimestamp(FileUtils.lastModified(fileName), fileCreated));
            pw.printf("File length: %d\n", fileLength);
            pw.printf("The last chunk is not listed\n");
            pw.printf("Chunk length: %d\n", chunkLength);
            pw.printf("Chunk count: %d\n", chunks.size());
            pw.printf("Used space: %d%%\n", getPercent(chunkLength, fileLength));
            pw.printf("Chunk fill rate: %d%%\n", maxLength == 0 ? 100 :
                    getPercent(maxLengthLive, maxLength));
            pw.printf("Chunk fill rate excluding empty chunks: %d%%\n",
                    maxLengthNotEmpty == 0 ? 100 :
                            getPercent(maxLengthLive, maxLengthNotEmpty));
            for (Map.Entry<Integer, Chunk> e : chunks.entrySet()) {
                Chunk c = e.getValue();
                long created = fileCreated + c.time;
                pw.printf("  Chunk %d: %s, %d%% used, %d blocks",
                        c.id, formatTimestamp(created, fileCreated),
                        getPercent(c.maxLenLive, c.maxLen),
                        c.len
                );
                if (c.maxLenLive == 0) {
                    pw.printf(", unused: %s",
                            formatTimestamp(fileCreated + c.unused, fileCreated));
                }
                pw.printf("\n");
            }
            pw.printf("\n");
        } catch (Exception e) {
            pw.println("ERROR: " + e);
            e.printStackTrace(pw);
            return e.getMessage();
        } finally {
            store.close();
        }
        pw.flush();
        return null;
    }

    /**
     * Read the summary information of the file and write them to system out.
     *
     * @param fileName the name of the file.
     * @param writer the print writer.
     * @return null if successful (if there was no error), otherwise the error message
     */
    private static String info(String fileName, Writer writer) {
        PrintWriter pw = new PrintWriter(writer, true);
        if (!FilePath.get(fileName).exists()) {
            pw.println("File not found: " + fileName);
            return "File not found: " + fileName;
        }
        long fileLength = FileUtils.size(fileName);
        MVStore store = new MVStore.Builder().
                fileName(fileName).
                readOnly().open();
        try {
            MVMap<String, String> meta = store.getMetaMap();
            Map<String, Object> header = store.getStoreHeader();
            long fileCreated = DataUtils.readHexLong(header, "created", 0L);
            TreeMap<Integer, Chunk> chunks = new TreeMap<Integer, Chunk>();
            long chunkLength = 0;
            long maxLength = 0;
            long maxLengthLive = 0;
            long maxLengthNotEmpty = 0;
            for (Map.Entry<String, String> e : meta.entrySet()) {
                String k = e.getKey();
                if (k.startsWith("chunk.")) {
                    Chunk c = Chunk.fromString(e.getValue());
                    chunks.put(c.id, c);
                    chunkLength += c.len * BLOCK_SIZE;
                    maxLength += c.maxLen;
                    maxLengthLive += c.maxLenLive;
                    if (c.maxLenLive > 0) {
                        maxLengthNotEmpty += c.maxLen;
                    }
                }
            }
            pw.printf("Created: %s\n", formatTimestamp(fileCreated, fileCreated));
            pw.printf("Last modified: %s\n",
                    formatTimestamp(FileUtils.lastModified(fileName), fileCreated));
            pw.printf("File length: %d\n", fileLength);
            pw.printf("The last chunk is not listed\n");
            pw.printf("Chunk length: %d\n", chunkLength);
            pw.printf("Chunk count: %d\n", chunks.size());
            pw.printf("Used space: %d%%\n", getPercent(chunkLength, fileLength));
            pw.printf("Chunk fill rate: %d%%\n", maxLength == 0 ? 100 :
                    getPercent(maxLengthLive, maxLength));
            pw.printf("Chunk fill rate excluding empty chunks: %d%%\n",
                    maxLengthNotEmpty == 0 ? 100 :
                            getPercent(maxLengthLive, maxLengthNotEmpty));
            for (Map.Entry<Integer, Chunk> e : chunks.entrySet()) {
                Chunk c = e.getValue();
                long created = fileCreated + c.time;
                pw.printf("  Chunk %d: %s, %d%% used, %d blocks",
                        c.id, formatTimestamp(created, fileCreated),
                        getPercent(c.maxLenLive, c.maxLen),
                        c.len
                );
                if (c.maxLenLive == 0) {
                    pw.printf(", unused: %s",
                            formatTimestamp(fileCreated + c.unused, fileCreated));
                }
                pw.printf("\n");
            }
            pw.printf("\n");
        } catch (Exception e) {
            pw.println("ERROR: " + e);
            e.printStackTrace(pw);
            return e.getMessage();
        } finally {
            store.close();
        }
        pw.flush();
        return null;
    }

Replace Generic With Diamond TreeMap<Integer,Chunk> with TreeMap<> in method private info(fileName String, writer Writer) : String from class org.dizitart.no2.tool.Recovery


    /**
     * Executes the given batch of INSERT SQL statements.
     * @param <T> The type of object that the handler returns
     * @param conn The connection to use to run the query.
     * @param sql The SQL to execute.
     * @param rsh The handler used to create the result object from
     * the {@code ResultSet} of auto-generated keys.
     * @param params The query replacement parameters.
     * @return The result generated by the handler.
     * @throws SQLException if a database access error occurs
     * @since 1.6
     */
    public <T> T insertBatch(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object[][] params) throws SQLException {
        if (conn == null) {
            throw new SQLException("Null connection");
        }

        if (sql == null) {
            throw new SQLException("Null SQL statement");
        }

        if (params == null) {
            throw new SQLException("Null parameters. If parameters aren't need, pass an empty array.");
        }

        PreparedStatement stmt = null;
        T generatedKeys = null;
        try {
            stmt = this.prepareStatement(conn, sql, Statement.RETURN_GENERATED_KEYS);

            for (final Object[] param : params) {
                this.fillStatement(stmt, param);
                stmt.addBatch();
            }
            stmt.executeBatch();
            try (ResultSet rs = stmt.getGeneratedKeys()) {
                generatedKeys = rsh.handle(rs);
            }
        } catch (final SQLException e) {
            this.rethrow(e, sql, (Object[])params);
        } finally {
            close(stmt);
        }

        return generatedKeys;
    }

    /**
     * Executes the given batch of INSERT SQL statements.
     * @param <T> The type of object that the handler returns
     * @param conn The connection to use to run the query.
     * @param sql The SQL to execute.
     * @param rsh The handler used to create the result object from
     * the {@code ResultSet} of auto-generated keys.
     * @param params The query replacement parameters.
     * @return The result generated by the handler.
     * @throws SQLException if a database access error occurs
     * @since 1.6
     */
    public <T> T insertBatch(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object[][] params) throws SQLException {
        if (conn == null) {
            throw new SQLException("Null connection");
        }

        if (sql == null) {
            throw new SQLException("Null SQL statement");
        }

        if (params == null) {
            throw new SQLException("Null parameters. If parameters aren't need, pass an empty array.");
        }

        PreparedStatement stmt = null;
        T generatedKeys = null;
        try {
            stmt = this.prepareStatement(conn, sql, Statement.RETURN_GENERATED_KEYS);

            for (final Object[] param : params) {
                this.fillStatement(stmt, param);
                stmt.addBatch();
            }
            stmt.executeBatch();
            final ResultSet rs = stmt.getGeneratedKeys();
            generatedKeys = rsh.handle(rs);

        } catch (final SQLException e) {
            this.rethrow(e, sql, (Object[])params);
        } finally {
            close(stmt);
        }

        return generatedKeys;
    }

Try With Resources try(ResultSet rs=stmt.getGeneratedKeys()) in method public insertBatch(conn Connection, sql String, rsh ResultSetHandler<T>, params Object[][]) : T from class org.apache.commons.dbutils.QueryRunner


    /**
     * Execute an SQL INSERT query.
     * @param <T> The type of object that the handler returns
     * @param conn The connection to use to run the query.
     * @param sql The SQL to execute.
     * @param rsh The handler used to create the result object from
     * the {@code ResultSet} of auto-generated keys.
     * @param params The query replacement parameters.
     * @return An object generated by the handler.
     * @throws SQLException if a database access error occurs
     * @since 1.6
     */
    public <T> T insert(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
        if (conn == null) {
            throw new SQLException("Null connection");
        }

        if (sql == null) {
            throw new SQLException("Null SQL statement");
        }

        if (rsh == null) {
            throw new SQLException("Null ResultSetHandler");
        }

        Statement stmt = null;
        T generatedKeys = null;

        try {
            if (params != null && params.length > 0) {
                final PreparedStatement ps = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
                stmt = ps;
                this.fillStatement(ps, params);
                ps.executeUpdate();
            } else {
                stmt = conn.createStatement();
                stmt.executeUpdate(sql, Statement.RETURN_GENERATED_KEYS);
            }
            try (ResultSet resultSet = stmt.getGeneratedKeys()) {
                generatedKeys = rsh.handle(resultSet);
            }
        } catch (final SQLException e) {
            this.rethrow(e, sql, params);
        } finally {
            close(stmt);
        }

        return generatedKeys;
    }

    /**
     * Execute an SQL INSERT query.
     * @param <T> The type of object that the handler returns
     * @param conn The connection to use to run the query.
     * @param sql The SQL to execute.
     * @param rsh The handler used to create the result object from
     * the {@code ResultSet} of auto-generated keys.
     * @param params The query replacement parameters.
     * @return An object generated by the handler.
     * @throws SQLException if a database access error occurs
     * @since 1.6
     */
    public <T> T insert(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
        if (conn == null) {
            throw new SQLException("Null connection");
        }

        if (sql == null) {
            throw new SQLException("Null SQL statement");
        }

        if (rsh == null) {
            throw new SQLException("Null ResultSetHandler");
        }

        Statement stmt = null;
        T generatedKeys = null;

        try {
            if (params != null && params.length > 0) {
                final PreparedStatement ps = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
                stmt = ps;
                this.fillStatement(ps, params);
                ps.executeUpdate();
            } else {
                stmt = conn.createStatement();
                stmt.executeUpdate(sql, Statement.RETURN_GENERATED_KEYS);
            }
            final ResultSet resultSet = stmt.getGeneratedKeys();
            generatedKeys = rsh.handle(resultSet);
        } catch (final SQLException e) {
            this.rethrow(e, sql, params);
        } finally {
            close(stmt);
        }

        return generatedKeys;
    }

Try With Resources try(ResultSet resultSet=stmt.getGeneratedKeys()) in method public insert(conn Connection, sql String, rsh ResultSetHandler<T>, params Object...) : T from class org.apache.commons.dbutils.QueryRunner


    /**
     * Invokes the stored procedure via update after checking the parameters to
     * ensure nothing is null.
     * @param conn The connection to use for the update call.
     * @param closeConn True if the connection should be closed, false otherwise.
     * @param sql The SQL statement to execute.
     * @param rsh The result set handler
     * @param params An array of update replacement parameters.  Each row in
     * this array is one set of update replacement values.
     * @return List of all objects generated by the ResultSetHandler for all result sets handled.
     * @throws SQLException If there are database or parameter errors.
     */
    private <T> List<T> execute(final Connection conn, final boolean closeConn, final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
        if (conn == null) {
            throw new SQLException("Null connection");
        }

        if (sql == null) {
            if (closeConn) {
                close(conn);
            }
            throw new SQLException("Null SQL statement");
        }

        if (rsh == null) {
            if (closeConn) {
                close(conn);
            }
            throw new SQLException("Null ResultSetHandler");
        }

        CallableStatement stmt = null;
        final List<T> results = new LinkedList<>();

        try {
            stmt = this.prepareCall(conn, sql);
            this.fillStatement(stmt, params);
            boolean moreResultSets = stmt.execute();
            // Handle multiple result sets by passing them through the handler
            // retaining the final result
            while (moreResultSets) {
                try (@SuppressWarnings("resource")
                // assume the ResultSet wrapper properly closes
                ResultSet rs = this.wrap(stmt.getResultSet())) {
                    results.add(rsh.handle(rs));
                    moreResultSets = stmt.getMoreResults();
                }
            }
            this.retrieveOutParameters(stmt, params);

        } catch (final SQLException e) {
            this.rethrow(e, sql, params);

        } finally {
            close(stmt);
            if (closeConn) {
                close(conn);
            }
        }

        return results;
    }

    /**
     * Invokes the stored procedure via update after checking the parameters to
     * ensure nothing is null.
     * @param conn The connection to use for the update call.
     * @param closeConn True if the connection should be closed, false otherwise.
     * @param sql The SQL statement to execute.
     * @param rsh The result set handler
     * @param params An array of update replacement parameters.  Each row in
     * this array is one set of update replacement values.
     * @return List of all objects generated by the ResultSetHandler for all result sets handled.
     * @throws SQLException If there are database or parameter errors.
     */
    private <T> List<T> execute(final Connection conn, final boolean closeConn, final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
        if (conn == null) {
            throw new SQLException("Null connection");
        }

        if (sql == null) {
            if (closeConn) {
                close(conn);
            }
            throw new SQLException("Null SQL statement");
        }

        if (rsh == null) {
            if (closeConn) {
                close(conn);
            }
            throw new SQLException("Null ResultSetHandler");
        }

        CallableStatement stmt = null;
        final List<T> results = new LinkedList<>();

        try {
            stmt = this.prepareCall(conn, sql);
            this.fillStatement(stmt, params);
            boolean moreResultSets = stmt.execute();
            // Handle multiple result sets by passing them through the handler
            // retaining the final result
            ResultSet rs = null;
            while (moreResultSets) {
                try {
                    rs = this.wrap(stmt.getResultSet());
                    results.add(rsh.handle(rs));
                    moreResultSets = stmt.getMoreResults();

                } finally {
                    close(rs);
                }
            }
            this.retrieveOutParameters(stmt, params);

        } catch (final SQLException e) {
            this.rethrow(e, sql, params);

        } finally {
            close(stmt);
            if (closeConn) {
                close(conn);
            }
        }

        return results;
    }

Try With Resources try(@SuppressWarnings("resource") ResultSet rs=this.wrap(stmt.getResultSet())) in method private execute(conn Connection, closeConn boolean, sql String, rsh ResultSetHandler<T>, params Object...) : List<T> from class org.apache.commons.dbutils.QueryRunner


    @Test
    public void testGoodBatchInsert() throws Exception {
        results = mock(ResultSet.class);
        resultsMeta = mock(ResultSetMetaData.class);

        when(meta.getParameterCount()).thenReturn(2);
        when(conn.prepareStatement(any(String.class), eq(Statement.RETURN_GENERATED_KEYS))).thenReturn(prepStmt);
        when(prepStmt.getGeneratedKeys()).thenReturn(results);
        when(results.next()).thenReturn(true).thenReturn(true).thenReturn(false);

        final ResultSetHandler<List<Object>> handler = rs -> {
            final List<Object> objects = new ArrayList<>();
            while (rs.next())
            {
                objects.add(new Object());
            }
            return objects;
        };

        final Object[][] params = new Object[2][2];
        params[0][0] = "Test";
        params[0][1] = "Blah";
        params[1][0] = "Test2";
        params[1][1] = "Blah2";

        final List<Object> generatedKeys = runner.insertBatch("INSERT INTO blah(col1, col2) VALUES(?,?)", handler, params);

        verify(prepStmt, times(2)).addBatch();
        verify(prepStmt, times(1)).executeBatch();
        verify(prepStmt, times(1)).close();    // make sure we closed the statement
        verify(conn, times(1)).close();    // make sure we closed the connection

        Assert.assertEquals(2, generatedKeys.size());
    }

    @Test
    public void testGoodBatchInsert() throws Exception {
        results = mock(ResultSet.class);
        resultsMeta = mock(ResultSetMetaData.class);

        when(meta.getParameterCount()).thenReturn(2);
        when(conn.prepareStatement(any(String.class), eq(Statement.RETURN_GENERATED_KEYS))).thenReturn(prepStmt);
        when(prepStmt.getGeneratedKeys()).thenReturn(results);
        when(results.next()).thenReturn(true).thenReturn(true).thenReturn(false);

        final ResultSetHandler<List<Object>> handler = new ResultSetHandler<List<Object>>()
        {
            @Override
            public List<Object> handle(final ResultSet rs) throws SQLException
            {
                final List<Object> objects = new ArrayList<>();
                while (rs.next())
                {
                    objects.add(new Object());
                }
                return objects;
            }
        };

        final Object[][] params = new Object[2][2];
        params[0][0] = "Test";
        params[0][1] = "Blah";
        params[1][0] = "Test2";
        params[1][1] = "Blah2";

        final List<Object> generatedKeys = runner.insertBatch("INSERT INTO blah(col1, col2) VALUES(?,?)", handler, params);

        verify(prepStmt, times(2)).addBatch();
        verify(prepStmt, times(1)).executeBatch();
        verify(prepStmt, times(1)).close();    // make sure we closed the statement
        verify(conn, times(1)).close();    // make sure we closed the connection

        Assert.assertEquals(2, generatedKeys.size());
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.QueryRunnerTest.testGoodBatchInsert.handler.new ResultSetHandler<List<Object>> with rs -> {final List<Object> objects=new ArrayList<>(); in method public testGoodBatchInsert() : void from class org.apache.commons.dbutils.QueryRunnerTest


    @Test
    public void testGoodInsert() throws Exception {
        results = mock(ResultSet.class);

        when(meta.getParameterCount()).thenReturn(2);
        when(conn.prepareStatement(any(String.class), eq(Statement.RETURN_GENERATED_KEYS))).thenReturn(prepStmt);
        when(prepStmt.getGeneratedKeys()).thenReturn(results);
        when(results.next()).thenReturn(true).thenReturn(false);
        when(results.getObject(1)).thenReturn(1L);

        final Long generatedKey = runner.insert("INSERT INTO blah(col1, col2) VALUES(?,?)", new ScalarHandler<>(), "unit", "test");

        verify(prepStmt, times(1)).executeUpdate();
        verify(prepStmt, times(1)).close();    // make sure we closed the statement
        verify(conn, times(1)).close();    // make sure we closed the connection

        Assert.assertEquals(1L, generatedKey.longValue());
    }

    @Test
    public void testGoodInsert() throws Exception {
        results = mock(ResultSet.class);

        when(meta.getParameterCount()).thenReturn(2);
        when(conn.prepareStatement(any(String.class), eq(Statement.RETURN_GENERATED_KEYS))).thenReturn(prepStmt);
        when(prepStmt.getGeneratedKeys()).thenReturn(results);
        when(results.next()).thenReturn(true).thenReturn(false);
        when(results.getObject(1)).thenReturn(1L);

        final Long generatedKey = runner.insert("INSERT INTO blah(col1, col2) VALUES(?,?)", new ScalarHandler<Long>(), "unit", "test");

        verify(prepStmt, times(1)).executeUpdate();
        verify(prepStmt, times(1)).close();    // make sure we closed the statement
        verify(conn, times(1)).close();    // make sure we closed the connection

        Assert.assertEquals(1L, generatedKey.longValue());
    }

Replace Generic With Diamond ScalarHandler<Long> with ScalarHandler<> in method public testGoodInsert() : void from class org.apache.commons.dbutils.QueryRunnerTest


    public void testHandleToInterface() throws SQLException {
        final ResultSetHandler<List<SubTestBeanInterface>> h = new BeanListHandler<>(SubTestBean.class);
        final List<SubTestBeanInterface> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        final Iterator<SubTestBeanInterface> iter = results.iterator();
        SubTestBeanInterface row;
        assertTrue(iter.hasNext());
        row = iter.next();
        assertSame(SubTestBean.class, row.getClass());

        assertEquals("1", row.getOne());
        assertEquals("2", row.getTwo());
        assertEquals(TestBean.Ordinal.THREE, row.getThree());
        assertEquals("not set", row.getDoNotSet());

        assertTrue(iter.hasNext());
        row = iter.next();
        assertSame(SubTestBean.class, row.getClass());

        assertEquals("4", row.getOne());
        assertEquals("5", row.getTwo());
        assertEquals(TestBean.Ordinal.SIX, row.getThree());
        assertEquals("not set", row.getDoNotSet());

        assertFalse(iter.hasNext());
    }

    public void testHandleToInterface() throws SQLException {
        final ResultSetHandler<List<SubTestBeanInterface>> h = new BeanListHandler<SubTestBeanInterface>(SubTestBean.class);
        final List<SubTestBeanInterface> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        final Iterator<SubTestBeanInterface> iter = results.iterator();
        SubTestBeanInterface row;
        assertTrue(iter.hasNext());
        row = iter.next();
        assertSame(SubTestBean.class, row.getClass());

        assertEquals("1", row.getOne());
        assertEquals("2", row.getTwo());
        assertEquals(TestBean.Ordinal.THREE, row.getThree());
        assertEquals("not set", row.getDoNotSet());

        assertTrue(iter.hasNext());
        row = iter.next();
        assertSame(SubTestBean.class, row.getClass());

        assertEquals("4", row.getOne());
        assertEquals("5", row.getTwo());
        assertEquals(TestBean.Ordinal.SIX, row.getThree());
        assertEquals("not set", row.getDoNotSet());

        assertFalse(iter.hasNext());
    }

Replace Generic With Diamond BeanListHandler<SubTestBeanInterface> with BeanListHandler<> in method public testHandleToInterface() : void from class org.apache.commons.dbutils.handlers.BeanListHandlerTest


    public void testHandleToSuperClass() throws SQLException {
        final ResultSetHandler<List<TestBean>> h = new BeanListHandler<>(SubTestBean.class);
        final List<TestBean> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        final Iterator<TestBean> iter = results.iterator();
        assertTrue(iter.hasNext());
        TestBean row = iter.next();
        assertSame(SubTestBean.class, row.getClass());

        assertEquals("1", row.getOne());
        assertEquals("2", row.getTwo());
        assertEquals(TestBean.Ordinal.THREE, row.getThree());
        assertEquals("not set", row.getDoNotSet());

        assertTrue(iter.hasNext());
        row = iter.next();
        assertSame(SubTestBean.class, row.getClass());

        assertEquals("4", row.getOne());
        assertEquals("5", row.getTwo());
        assertEquals(TestBean.Ordinal.SIX, row.getThree());
        assertEquals("not set", row.getDoNotSet());

        assertFalse(iter.hasNext());
    }

    public void testHandleToSuperClass() throws SQLException {
        final ResultSetHandler<List<TestBean>> h = new BeanListHandler<TestBean>(SubTestBean.class);
        final List<TestBean> results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals(ROWS, results.size());

        final Iterator<TestBean> iter = results.iterator();
        assertTrue(iter.hasNext());
        TestBean row = iter.next();
        assertSame(SubTestBean.class, row.getClass());

        assertEquals("1", row.getOne());
        assertEquals("2", row.getTwo());
        assertEquals(TestBean.Ordinal.THREE, row.getThree());
        assertEquals("not set", row.getDoNotSet());

        assertTrue(iter.hasNext());
        row = iter.next();
        assertSame(SubTestBean.class, row.getClass());

        assertEquals("4", row.getOne());
        assertEquals("5", row.getTwo());
        assertEquals(TestBean.Ordinal.SIX, row.getThree());
        assertEquals("not set", row.getDoNotSet());

        assertFalse(iter.hasNext());
    }

Replace Generic With Diamond BeanListHandler<TestBean> with BeanListHandler<> in method public testHandleToSuperClass() : void from class org.apache.commons.dbutils.handlers.BeanListHandlerTest


    public void testHandleToInterface() throws SQLException {
        final ResultSetHandler<SubTestBeanInterface> h = new BeanHandler<>(SubTestBean.class);
        final SubTestBeanInterface results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals("1", results.getOne());
        assertEquals("2", results.getTwo());
        assertEquals(TestBean.Ordinal.THREE, results.getThree());
        assertEquals("not set", results.getDoNotSet());
    }

    public void testHandleToInterface() throws SQLException {
        final ResultSetHandler<SubTestBeanInterface> h = new BeanHandler<SubTestBeanInterface>(SubTestBean.class);
        final SubTestBeanInterface results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals("1", results.getOne());
        assertEquals("2", results.getTwo());
        assertEquals(TestBean.Ordinal.THREE, results.getThree());
        assertEquals("not set", results.getDoNotSet());
    }

Replace Generic With Diamond BeanHandler<SubTestBeanInterface> with BeanHandler<> in method public testHandleToInterface() : void from class org.apache.commons.dbutils.handlers.BeanHandlerTest


    public void testHandleToSuperClass() throws SQLException {
        final ResultSetHandler<TestBean> h = new BeanHandler<>(SubTestBean.class);
        final TestBean results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals("1", results.getOne());
        assertEquals("2", results.getTwo());
        assertEquals(TestBean.Ordinal.THREE, results.getThree());
        assertEquals("not set", results.getDoNotSet());
    }

    public void testHandleToSuperClass() throws SQLException {
        final ResultSetHandler<TestBean> h = new BeanHandler<TestBean>(SubTestBean.class);
        final TestBean results = h.handle(this.rs);

        assertNotNull(results);
        assertEquals("1", results.getOne());
        assertEquals("2", results.getTwo());
        assertEquals(TestBean.Ordinal.THREE, results.getThree());
        assertEquals("not set", results.getDoNotSet());
    }

Replace Generic With Diamond BeanHandler<TestBean> with BeanHandler<> in method public testHandleToSuperClass() : void from class org.apache.commons.dbutils.handlers.BeanHandlerTest


    /**
     * Generates an {@code Iterable}, suitable for use in for-each loops.
     *
     * @param rs Wrap this {@code ResultSet} in an {@code Iterator}.
     * @return an {@code Iterable}, suitable for use in for-each loops.
     */
    public static Iterable<Object[]> iterable(final ResultSet rs) {
        return () -> new ResultSetIterator(rs);
    }

    /**
     * Generates an {@code Iterable}, suitable for use in for-each loops.
     *
     * @param rs Wrap this {@code ResultSet} in an {@code Iterator}.
     * @return an {@code Iterable}, suitable for use in for-each loops.
     */
    public static Iterable<Object[]> iterable(final ResultSet rs) {
        return new Iterable<Object[]>() {

            @Override
            public Iterator<Object[]> iterator() {
                return new ResultSetIterator(rs);
            }

        };
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.ResultSetIterator.iterable.new Iterable<Object[]> with () -> new ResultSetIterator(rs) in method public iterable(rs ResultSet) : Iterable<Object[]> from class org.apache.commons.dbutils.ResultSetIterator


    /**
     * Constructor for BeanProcessor.
     */
    public BeanProcessor() {
        this(new HashMap<>());
    }

    /**
     * Constructor for BeanProcessor.
     */
    public BeanProcessor() {
        this(new HashMap<String, String>());
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public BeanProcessor() from class org.apache.commons.dbutils.BeanProcessor


    /**
     * Execute a batch of SQL INSERT, UPDATE, or DELETE queries.
     *
     * @param conn The {@code Connection} to use to run the query.  The caller is
     * responsible for closing this Connection.
     * @param sql The SQL to execute.
     * @param params An array of query replacement parameters.  Each row in
     * this array is one set of batch replacement values.
     * @return A {@code Future} which returns the number of rows updated per statement.
     * @throws SQLException if a database access error occurs
     */
    public Future<int[]> batch(final Connection conn, final String sql, final Object[][] params) throws SQLException {
        return executorService.submit(() -> queryRunner.batch(conn, sql, params));
    }

    /**
     * Execute a batch of SQL INSERT, UPDATE, or DELETE queries.
     *
     * @param conn The {@code Connection} to use to run the query.  The caller is
     * responsible for closing this Connection.
     * @param sql The SQL to execute.
     * @param params An array of query replacement parameters.  Each row in
     * this array is one set of batch replacement values.
     * @return A {@code Future} which returns the number of rows updated per statement.
     * @throws SQLException if a database access error occurs
     */
    public Future<int[]> batch(final Connection conn, final String sql, final Object[][] params) throws SQLException {
        return executorService.submit(new Callable<int[]>() {

            @Override
            public int[] call() throws Exception {
                return queryRunner.batch(conn, sql, params);
            }

        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.batch.submit.new Callable<int[]> with () -> queryRunner.batch(conn,sql,params) in method public batch(conn Connection, sql String, params Object[][]) : Future<int[]> from class org.apache.commons.dbutils.AsyncQueryRunner


    /**
     * Execute a batch of SQL INSERT, UPDATE, or DELETE queries.  The
     * {@code Connection} is retrieved from the {@code DataSource}
     * set in the constructor.  This {@code Connection} must be in
     * auto-commit mode or the update will not be saved.
     *
     * @param sql The SQL to execute.
     * @param params An array of query replacement parameters.  Each row in
     * this array is one set of batch replacement values.
     * @return A {@code Future} which returns the number of rows updated per statement.
     * @throws SQLException if a database access error occurs
     */
    public Future<int[]> batch(final String sql, final Object[][] params) throws SQLException {
        return executorService.submit(() -> queryRunner.batch(sql, params));
    }

    /**
     * Execute a batch of SQL INSERT, UPDATE, or DELETE queries.  The
     * {@code Connection} is retrieved from the {@code DataSource}
     * set in the constructor.  This {@code Connection} must be in
     * auto-commit mode or the update will not be saved.
     *
     * @param sql The SQL to execute.
     * @param params An array of query replacement parameters.  Each row in
     * this array is one set of batch replacement values.
     * @return A {@code Future} which returns the number of rows updated per statement.
     * @throws SQLException if a database access error occurs
     */
    public Future<int[]> batch(final String sql, final Object[][] params) throws SQLException {
        return executorService.submit(new Callable<int[]>() {

            @Override
            public int[] call() throws Exception {
                return queryRunner.batch(sql, params);
            }

        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.batch.submit.new Callable<int[]> with () -> queryRunner.batch(sql,params) in method public batch(sql String, params Object[][]) : Future<int[]> from class org.apache.commons.dbutils.AsyncQueryRunner


    /**
     * Executes {@link QueryRunner#insert(Connection, String, ResultSetHandler)} asynchronously.
     *
     * @param <T> Return type expected
     * @param conn {@link Connection} to use to execute the SQL statement
     * @param sql SQL insert statement to execute
     * @param rsh {@link ResultSetHandler} for handling the results
     * @return {@link Future} that executes a query runner insert
     * @see QueryRunner#insert(Connection, String, ResultSetHandler)
     * @throws SQLException if a database access error occurs
     * @since 1.6
     */
    public <T> Future<T> insert(final Connection conn, final String sql, final ResultSetHandler<T> rsh) throws SQLException {
        return executorService.submit(() -> queryRunner.insert(conn, sql, rsh));
    }

    /**
     * Executes {@link QueryRunner#insert(Connection, String, ResultSetHandler)} asynchronously.
     *
     * @param <T> Return type expected
     * @param conn {@link Connection} to use to execute the SQL statement
     * @param sql SQL insert statement to execute
     * @param rsh {@link ResultSetHandler} for handling the results
     * @return {@link Future} that executes a query runner insert
     * @see QueryRunner#insert(Connection, String, ResultSetHandler)
     * @throws SQLException if a database access error occurs
     * @since 1.6
     */
    public <T> Future<T> insert(final Connection conn, final String sql, final ResultSetHandler<T> rsh) throws SQLException {
        return executorService.submit(new Callable<T>() {

            @Override
            public T call() throws Exception {
                return queryRunner.insert(conn, sql, rsh);
            }
        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.insert.submit.new Callable<T> with () -> queryRunner.insert(conn,sql,rsh) in method public insert(conn Connection, sql String, rsh ResultSetHandler<T>) : Future<T> from class org.apache.commons.dbutils.AsyncQueryRunner


    /**
     * Executes {@link QueryRunner#insert(Connection, String, ResultSetHandler, Object...)} asynchronously.
     *
     * @param <T> Return type expected
     * @param conn {@link Connection} to use to execute the SQL statement
     * @param sql SQL insert statement to execute
     * @param rsh {@link ResultSetHandler} for handling the results
     * @param params Parameter values for substitution in the SQL statement
     * @return {@link Future} that executes a query runner insert
     * @see QueryRunner#insert(Connection, String, ResultSetHandler, Object...)
     * @throws SQLException if a database access error occurs
     * @since 1.6
     */
    public <T> Future<T> insert(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
        return executorService.submit(() -> queryRunner.insert(conn, sql, rsh, params));
    }

    /**
     * Executes {@link QueryRunner#insert(Connection, String, ResultSetHandler, Object...)} asynchronously.
     *
     * @param <T> Return type expected
     * @param conn {@link Connection} to use to execute the SQL statement
     * @param sql SQL insert statement to execute
     * @param rsh {@link ResultSetHandler} for handling the results
     * @param params Parameter values for substitution in the SQL statement
     * @return {@link Future} that executes a query runner insert
     * @see QueryRunner#insert(Connection, String, ResultSetHandler, Object...)
     * @throws SQLException if a database access error occurs
     * @since 1.6
     */
    public <T> Future<T> insert(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
        return executorService.submit(new Callable<T>() {

            @Override
            public T call() throws Exception {
                return queryRunner.insert(conn, sql, rsh, params);
            }
        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.insert.submit.new Callable<T> with () -> queryRunner.insert(conn,sql,rsh,params) in method public insert(conn Connection, sql String, rsh ResultSetHandler<T>, params Object...) : Future<T> from class org.apache.commons.dbutils.AsyncQueryRunner


    /**
     * Executes {@link QueryRunner#insert(String, ResultSetHandler)} asynchronously.
     *
     * @param <T> Return type expected
     * @param sql SQL insert statement to execute
     * @param rsh {@link ResultSetHandler} for handling the results
     * @return {@link Future} that executes a query runner insert
     * @see QueryRunner#insert(String, ResultSetHandler)
     * @throws SQLException if a database access error occurs
     * @since 1.6
     */
    public <T> Future<T> insert(final String sql, final ResultSetHandler<T> rsh) throws SQLException {
        return executorService.submit(() -> queryRunner.insert(sql, rsh));
    }

    /**
     * Executes {@link QueryRunner#insert(String, ResultSetHandler)} asynchronously.
     *
     * @param <T> Return type expected
     * @param sql SQL insert statement to execute
     * @param rsh {@link ResultSetHandler} for handling the results
     * @return {@link Future} that executes a query runner insert
     * @see QueryRunner#insert(String, ResultSetHandler)
     * @throws SQLException if a database access error occurs
     * @since 1.6
     */
    public <T> Future<T> insert(final String sql, final ResultSetHandler<T> rsh) throws SQLException {
        return executorService.submit(new Callable<T>() {

            @Override
            public T call() throws Exception {
                return queryRunner.insert(sql, rsh);
            }

        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.insert.submit.new Callable<T> with () -> queryRunner.insert(sql,rsh) in method public insert(sql String, rsh ResultSetHandler<T>) : Future<T> from class org.apache.commons.dbutils.AsyncQueryRunner


    /**
     * Executes {@link QueryRunner#insert(String, ResultSetHandler, Object...)} asynchronously.
     *
     * @param <T> Return type expected
     * @param sql SQL insert statement to execute
     * @param rsh {@link ResultSetHandler} for handling the results
     * @param params Parameter values for substitution in the SQL statement
     * @return {@link Future} that executes a query runner insert
     * @see QueryRunner#insert(String, ResultSetHandler, Object...)
     * @throws SQLException if a database access error occurs
     * @since 1.6
     */
    public <T> Future<T> insert(final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
        return executorService.submit(() -> queryRunner.insert(sql, rsh, params));
    }

    /**
     * Executes {@link QueryRunner#insert(String, ResultSetHandler, Object...)} asynchronously.
     *
     * @param <T> Return type expected
     * @param sql SQL insert statement to execute
     * @param rsh {@link ResultSetHandler} for handling the results
     * @param params Parameter values for substitution in the SQL statement
     * @return {@link Future} that executes a query runner insert
     * @see QueryRunner#insert(String, ResultSetHandler, Object...)
     * @throws SQLException if a database access error occurs
     * @since 1.6
     */
    public <T> Future<T> insert(final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
        return executorService.submit(new Callable<T>() {

            @Override
            public T call() throws Exception {
                return queryRunner.insert(sql, rsh, params);
            }
        });
    }

Replace Anonymous With Lambda org.apache.commons.dbutils.AsyncQueryRunner.insert.submit.new Callable<T> with () -> queryRunner.insert(sql,rsh,params) in method public insert(sql String, rsh ResultSetHandler<T>, params Object...) : Future<T> from class org.apache.commons.dbutils.AsyncQueryRunner