    private final Review[] parseReviews(final Band band) {
        final List<Review> reviews = this.entity.getReviews();
        if (!reviews.isEmpty()) {
            final Review[] reviewArr = new Review[reviews.size()];
            return reviews.toArray(reviewArr);
        } else if (this.loadReviews) {
            final List<Review> parsedReviewList = new ArrayList<>();
            for (final Disc disc : band.getDiscs()) {
                try {
                    final ReviewParser parser = new ReviewParser(disc.getId());
                    for (final Review review : parser.parse()) {
                        review.setDisc(disc);
                        parsedReviewList.add(review);
                    }
                } catch (final ExecutionException e) {
                    logger.error("error in parsing " + Review.class + " for band: " + band, e);
                }
            }
            final Review[] reviewArr = new Review[parsedReviewList.size()];
            return parsedReviewList.toArray(reviewArr);
        } else {
            return new Review[0];
        }

    }

    private final Review[] parseReviews(final Band band) {
        final List<Review> reviews = this.entity.getReviews();
        if (!reviews.isEmpty()) {
            final Review[] reviewArr = new Review[reviews.size()];
            return reviews.toArray(reviewArr);
        } else if (this.loadReviews) {
            final List<Review> parsedReviewList = new ArrayList<Review>();
            for (final Disc disc : band.getDiscs()) {
                try {
                    final ReviewParser parser = new ReviewParser(disc.getId());
                    for (final Review review : parser.parse()) {
                        review.setDisc(disc);
                        parsedReviewList.add(review);
                    }
                } catch (final ExecutionException e) {
                    logger.error("error in parsing " + Review.class + " for band: " + band, e);
                }
            }
            final Review[] reviewArr = new Review[parsedReviewList.size()];
            return parsedReviewList.toArray(reviewArr);
        } else {
            return new Review[0];
        }

    }

Replace Generic With Diamond ArrayList<Review> with ArrayList<> in method private parseReviews(band Band) : Review[] from class com.github.loki.afro.metallum.core.parser.site.BandSiteParser


    private final Map<Integer, List<Band>> parseSimilarArtists() {
        final Map<Integer, List<Band>> similarArtists = this.entity.getSimilarArtists();
        if (!similarArtists.isEmpty()) {
            return similarArtists;
        } else if (this.loadSimilarArtists) {
            try {
                final SimilarArtistsParser sap = new SimilarArtistsParser(this.entity.getId());
                return sap.parse();
            } catch (final ExecutionException e) {
                logger.error("error in parsing similar Artists for band: " + this.entity, e);
            }
        }
        return new HashMap<>();
    }

    private final Map<Integer, List<Band>> parseSimilarArtists() {
        final Map<Integer, List<Band>> similarArtists = this.entity.getSimilarArtists();
        if (!similarArtists.isEmpty()) {
            return similarArtists;
        } else if (this.loadSimilarArtists) {
            try {
                final SimilarArtistsParser sap = new SimilarArtistsParser(this.entity.getId());
                return sap.parse();
            } catch (final ExecutionException e) {
                logger.error("error in parsing similar Artists for band: " + this.entity, e);
            }
        }
        return new HashMap<Integer, List<Band>>();
    }

Replace Generic With Diamond HashMap<Integer,List<Band>> with HashMap<> in method private parseSimilarArtists() : Map<Integer,List<Band>> from class com.github.loki.afro.metallum.core.parser.site.BandSiteParser


private List parseSubLabels(final String upperRightPart) {
        List labelList = new ArrayList<>();
        // must and with
 and at least 9 characters to match
        if (!upperRightPart.trim().matches(".{9,}?[
]$")) {
            return labelList;
        }
        final String[] labelLinks = upperRightPart.split(",");
        for (final String labelLink : labelLinks) {
            // prepare, to remove Online Shopping if it appears
            String parseAbleString = labelLink.replaceAll("(?imx)
.*", "").trim();
            // name
            String labelName = Jsoup.parse(parseAbleString).text();
            // id
            String labelId = parseAbleString.substring(0, parseAbleString.length() - (labelName.length() + 6));
            labelId = labelId.substring(labelId.lastIndexOf("/") + 1, labelId.length());
            labelList.add(new Label(Long.parseLong(labelId), labelName));
        }
        return labelList;
    }

private List parseSubLabels(final String upperRightPart) {
        List labelList = new ArrayList();
        // must and with
 and at least 9 characters to match
        if (!upperRightPart.trim().matches(".{9,}?[
]$")) {
            return labelList;
        }
        final String[] labelLinks = upperRightPart.split(",");
        for (final String labelLink : labelLinks) {
            // prepare, to remove Online Shopping if it appears
            String parseAbleString = labelLink.replaceAll("(?imx)
.*", "").trim();
            // name
            String labelName = Jsoup.parse(parseAbleString).text();
            // id
            String labelId = parseAbleString.substring(0, parseAbleString.length() - (labelName.length() + 6));
            labelId = labelId.substring(labelId.lastIndexOf("/") + 1, labelId.length());
            labelList.add(new Label(Long.parseLong(labelId), labelName));
        }
        return labelList;
    }

Replace Generic With Diamond ArrayList<Label> with ArrayList<> in method private parseSubLabels(upperRightPart String) : List<Label> from class com.github.loki.afro.metallum.core.parser.site.LabelSiteParser


/**
     * Can return a Map with the Band entry (as Key) where Band.getId () = 0 & Band.getName(Various
     * Artists)

     * You'll get this when the Label also releases a SplitDisc., in the List<Disc> of that band,

     * which is the SplitDisc you'll get the real Bands.

     *

     * ONLY if option is set
     *
     * @return the Map with Band as Key and Integer as Value representing the quantum of releases

     * If there are none you'll get a empty HashMap.
     */
    private Map<Band, Integer> parsePastRoster() {
        final Map<Band, Integer> pastRoster = this.entity.getPastRoster();
        if (!pastRoster.isEmpty()) {
            return pastRoster;
        } else if (this.loadPastRooster != PARSE_STYLE.NONE) {
            // try {
            try {
                return new PastRosterParser(this.entity.getId(), Byte.MAX_VALUE, true, this.loadPastRooster).parse();
            } catch (final Exception e) {
                LOGGER.error("unable to parse past roster with " + this.loadPastRooster + " and " + this.entity, e);
            }
        }
        return new HashMap<>();
    }

/**
     * Can return a Map with the Band entry (as Key) where Band.getId () = 0 & Band.getName(Various
     * Artists)

     * You'll get this when the Label also releases a SplitDisc., in the List<Disc> of that band,

     * which is the SplitDisc you'll get the real Bands.

     *

     * ONLY if option is set
     *
     * @return the Map with Band as Key and Integer as Value representing the quantum of releases

     * If there are none you'll get a empty HashMap.
     */
    private Map<Band, Integer> parsePastRoster() {
        final Map<Band, Integer> pastRoster = this.entity.getPastRoster();
        if (!pastRoster.isEmpty()) {
            return pastRoster;
        } else if (this.loadPastRooster != PARSE_STYLE.NONE) {
            // try {
            try {
                return new PastRosterParser(this.entity.getId(), Byte.MAX_VALUE, true, this.loadPastRooster).parse();
            } catch (final Exception e) {
                LOGGER.error("unable to parse past roster with " + this.loadPastRooster + " and " + this.entity, e);
            }
        }
        return new HashMap<Band, Integer>();
    }

Replace Generic With Diamond HashMap<Band,Integer> with HashMap<> in method private parsePastRoster() : Map<Band,Integer> from class com.github.loki.afro.metallum.core.parser.site.LabelSiteParser


/**
     * You'll get a Map with Band as Key and Disc as Value.

     *

     * To go more into Detail: This method will return all the Discs which are released under this
     * Label

     * mapped to the specific Band

     *

     * ONLY if option is set
     *
     * @return a Map with Band as Key and a List with Discs.
     */
    private Map<Band, List<Disc>> parseReleases() {
        Map<Band, List<Disc>> releases = this.entity.getReleases();
        if (!releases.isEmpty()) {
            return releases;
        } else if (this.loadReleases != PARSE_STYLE.NONE) {
            try {
                return new ReleaseParser(this.entity.getId(), Byte.MAX_VALUE, true, this.loadReleases).parse();
            } catch (final Exception e) {
                LOGGER.error("unable to parse label releases with " + this.loadReleases + " and " + this.entity, e);
            }
        }
        return new HashMap<>();
    }

/**
     * You'll get a Map with Band as Key and Disc as Value.

     *

     * To go more into Detail: This method will return all the Discs which are released under this
     * Label

     * mapped to the specific Band

     *

     * ONLY if option is set
     *
     * @return a Map with Band as Key and a List with Discs.
     */
    private Map<Band, List<Disc>> parseReleases() {
        Map<Band, List<Disc>> releases = this.entity.getReleases();
        if (!releases.isEmpty()) {
            return releases;
        } else if (this.loadReleases != PARSE_STYLE.NONE) {
            try {
                return new ReleaseParser(this.entity.getId(), Byte.MAX_VALUE, true, this.loadReleases).parse();
            } catch (final Exception e) {
                LOGGER.error("unable to parse label releases with " + this.loadReleases + " and " + this.entity, e);
            }
        }
        return new HashMap<Band, List<Disc>>();
    }

Replace Generic With Diamond HashMap<Band,List<Disc>> with HashMap<> in method private parseReleases() : Map<Band,List<Disc>> from class com.github.loki.afro.metallum.core.parser.site.LabelSiteParser


    public Link[] parse() {
        final String[] linkHtml = this.html.split("id=\"header_");
        final List<Link> linkList = new ArrayList<>();
        for (int i = 1; i < linkHtml.length; i++) {
            final LinkCategory category = parseLinkCategory(linkHtml[i]);
            final String[] catLinks = linkHtml[i].split("id=\"link[\\d]");
            for (int j = 1; j < catLinks.length; j++) {
                final Link link = new Link();
                link.setCategory(category);
                link.setName(parseLinkName(catLinks[j]));
                link.setURL(parseLinkURL(catLinks[j]));
                linkList.add(link);
            }
        }
        return linkListAsArray(linkList);
    }

    public Link[] parse() {
        final String[] linkHtml = this.html.split("id=\"header_");
        final List<Link> linkList = new ArrayList<Link>();
        for (int i = 1; i < linkHtml.length; i++) {
            final LinkCategory category = parseLinkCategory(linkHtml[i]);
            final String[] catLinks = linkHtml[i].split("id=\"link[\\d]");
            for (int j = 1; j < catLinks.length; j++) {
                final Link link = new Link();
                link.setCategory(category);
                link.setName(parseLinkName(catLinks[j]));
                link.setURL(parseLinkURL(catLinks[j]));
                linkList.add(link);
            }
        }
        return linkListAsArray(linkList);
    }

Replace Generic With Diamond ArrayList<Link> with ArrayList<> in method public parse() : Link[] from class com.github.loki.afro.metallum.core.parser.site.helper.LinkParser


    public List<Review> parse() {
        final List<Review> reviews = new ArrayList<>();
        Elements elements = this.doc.select("div[class=reviewBox]");
        for (final Element element : elements) {
            final Review review = new Review();
            review.setId(parseReviewId(element));
            review.setName(parseTitle(element));
            review.setPercent(parsePercentage(element));
            review.setContent(parseBody(element));
            review.setAuthor(parseAuthor(element));
            review.setDate(parseDate(element));
            reviews.add(review);
        }
        return reviews;
    }

    public List<Review> parse() {
        final List<Review> reviews = new ArrayList<Review>();
        Elements elements = this.doc.select("div[class=reviewBox]");
        for (final Element element : elements) {
            final Review review = new Review();
            review.setId(parseReviewId(element));
            review.setName(parseTitle(element));
            review.setPercent(parsePercentage(element));
            review.setContent(parseBody(element));
            review.setAuthor(parseAuthor(element));
            review.setDate(parseDate(element));
            reviews.add(review);
        }
        return reviews;
    }

Replace Generic With Diamond ArrayList<Review> with ArrayList<> in method public parse() : List<Review> from class com.github.loki.afro.metallum.core.parser.site.helper.ReviewParser


    public final Disc[] parse() {
        List<Disc> discography = new LinkedList<>();
        Elements rows = this.doc.getElementsByTag("tr");
        for (int i = 1; i < rows.size(); i++) {
            Element row = rows.get(i);
            Elements cols = row.getElementsByTag("td");
            Disc disc = new Disc();
            disc.setId(parseDiscId(cols.first()));
            disc.setName(cols.first().text());
            disc.setDiscType(parseDiscType(cols.get(1)));
            disc.setReleaseDate(cols.get(2).text());
            disc.setHasReview(parseReview(cols.get(3)));
            discography.add(disc);
        }
        return discography.toArray(new Disc[discography.size()]);
    }

    public final Disc[] parse() {
        List<Disc> discography = new LinkedList<Disc>();
        Elements rows = this.doc.getElementsByTag("tr");
        for (int i = 1; i < rows.size(); i++) {
            Element row = rows.get(i);
            Elements cols = row.getElementsByTag("td");
            Disc disc = new Disc();
            disc.setId(parseDiscId(cols.first()));
            disc.setName(cols.first().text());
            disc.setDiscType(parseDiscType(cols.get(1)));
            disc.setReleaseDate(cols.get(2).text());
            disc.setHasReview(parseReview(cols.get(3)));
            discography.add(disc);
        }
        return discography.toArray(new Disc[discography.size()]);
    }

Replace Generic With Diamond LinkedList<Disc> with LinkedList<> in method public parse() : Disc[] from class com.github.loki.afro.metallum.core.parser.site.helper.band.DiscParser


    private final List<Band> parseMemberBands(final String htmlPart) {
        final List<Band> mBands = new ArrayList<>();
        if (!htmlPart.contains("See also:")) {
            return mBands;
        }

        final String[] bands = htmlPart.split("<a");
        for (int i = 1; i < bands.length; i++) {
            final Band band = new Band(0);
            band.setName(bands[i].substring(bands[i].indexOf(">") + 1, bands[i].indexOf("</a>")));

            String idStr = bands[i].substring(bands[i].indexOf("/bands/") + 7);
            idStr = idStr.substring(idStr.indexOf("/") + 1, idStr.indexOf("\">"));
            band.setId(Long.parseLong(idStr));

            mBands.add(band);
        }

        return mBands;
    }

    private final List<Band> parseMemberBands(final String htmlPart) {
        final List<Band> mBands = new ArrayList<Band>();
        if (!htmlPart.contains("See also:")) {
            return mBands;
        }

        final String[] bands = htmlPart.split("<a");
        for (int i = 1; i < bands.length; i++) {
            final Band band = new Band(0);
            band.setName(bands[i].substring(bands[i].indexOf(">") + 1, bands[i].indexOf("</a>")));

            String idStr = bands[i].substring(bands[i].indexOf("/bands/") + 7);
            idStr = idStr.substring(idStr.indexOf("/") + 1, idStr.indexOf("\">"));
            band.setId(Long.parseLong(idStr));

            mBands.add(band);
        }

        return mBands;
    }

Replace Generic With Diamond ArrayList<Band> with ArrayList<> in method private parseMemberBands(htmlPart String) : List<Band> from class com.github.loki.afro.metallum.core.parser.site.helper.band.MemberParser


    public Map<Integer, List<Band>> parse() {
        final Map<Integer, List<Band>> returnMap = new TreeMap<>();
        final String[] bandStringArray = this.html.split("<tr id=\"recRow_");
        for (int i = 1; i < bandStringArray.length; i++) {
            final String[] bandInformationStringArray = bandStringArray[i].split("<td>");
            int index = 1;
            final Band band = new Band(parseBandId(bandInformationStringArray[index]));
            band.setName(parseBandName(bandInformationStringArray[index++]));
            band.setCountry(parseCountry(bandInformationStringArray[index++]));
            band.setGenre(parseGenre(bandInformationStringArray[index++]));
            addToMap(returnMap, parseScore(bandInformationStringArray[index]), band);
        }
        return returnMap;
    }

    public Map<Integer, List<Band>> parse() {
        final Map<Integer, List<Band>> returnMap = new TreeMap<Integer, List<Band>>();
        final String[] bandStringArray = this.html.split("<tr id=\"recRow_");
        for (int i = 1; i < bandStringArray.length; i++) {
            final String[] bandInformationStringArray = bandStringArray[i].split("<td>");
            int index = 1;
            final Band band = new Band(parseBandId(bandInformationStringArray[index]));
            band.setName(parseBandName(bandInformationStringArray[index++]));
            band.setCountry(parseCountry(bandInformationStringArray[index++]));
            band.setGenre(parseGenre(bandInformationStringArray[index++]));
            addToMap(returnMap, parseScore(bandInformationStringArray[index]), band);
        }
        return returnMap;
    }

Replace Generic With Diamond TreeMap<Integer,List<Band>> with TreeMap<> in method public parse() : Map<Integer,List<Band>> from class com.github.loki.afro.metallum.core.parser.site.helper.band.SimilarArtistsParser


    private static Map<Integer, List<Band>> addToMap(final Map<Integer, List<Band>> theMap, final int key, final Band value) {
        List<Band> bandListFromMap = theMap.get(key);
        if (bandListFromMap == null) {
            bandListFromMap = new ArrayList<>();
            bandListFromMap.add(value);
        } else {
            bandListFromMap.add(value);
        }
        theMap.put(key, bandListFromMap);
        return theMap;
    }

    private static Map<Integer, List<Band>> addToMap(final Map<Integer, List<Band>> theMap, final int key, final Band value) {
        List<Band> bandListFromMap = theMap.get(key);
        if (bandListFromMap == null) {
            bandListFromMap = new ArrayList<Band>();
            bandListFromMap.add(value);
        } else {
            bandListFromMap.add(value);
        }
        theMap.put(key, bandListFromMap);
        return theMap;
    }

Replace Generic With Diamond ArrayList<Band> with ArrayList<> in method private addToMap(theMap Map<Integer,List<Band>>, key int, value Band) : Map<Integer,List<Band>> from class com.github.loki.afro.metallum.core.parser.site.helper.band.SimilarArtistsParser


    public Track[] parse() {
        Element tableElement = this.doc.select("table[class$=table_lyrics]").first();
        int counter = 1;
        boolean foundFirstFirstTrack = false;
        Elements rows = tableElement.select("tr[class~=(even|odd)]");
        List<Track> trackList = new ArrayList<>();
        for (final Element row : rows) {
            final String trackIdStr = parseTrackId(row);
            final long trackId = Long.parseLong(trackIdStr.replaceAll("[\\D]", ""));
            Track track = new Track(trackId);
            track.setName(parseTrackTitle(row, this.isSplit));
            track.setPlayTime(parsePlayTime(row));
            int trackNumber = parseTrackNumber(row);
            track.setTrackNumber(trackNumber);
            if (foundFirstFirstTrack && trackNumber == 1) {
                counter++;
            } else if (trackNumber == 1) {
                foundFirstFirstTrack = true;
            }
            track.setDiscNumber(counter);
//			because otherwise the bandName is always the same
            if (this.isSplit) {
                track.setBandName(parseBandName(row));
            }
            track.setInstrumental(parseIsInstrumental(row));
            if (this.loadLyrics && row.getElementById("lyricsButton" + trackIdStr) != null) {
                lazyInitLatch(rows.size());
                parseLyrics2(row, trackId, track);
            } else {
                signalDoneCountDown();
            }
            trackList.add(track);

        }
        waitUntilEverythingIsDone(rows.size());
        return trackList.toArray(new Track[trackList.size()]);
    }

    public Track[] parse() {
        Element tableElement = this.doc.select("table[class$=table_lyrics]").first();
        int counter = 1;
        boolean foundFirstFirstTrack = false;
        Elements rows = tableElement.select("tr[class~=(even|odd)]");
        List<Track> trackList = new ArrayList<Track>();
        for (final Element row : rows) {
            final String trackIdStr = parseTrackId(row);
            final long trackId = Long.parseLong(trackIdStr.replaceAll("[\\D]", ""));
            Track track = new Track(trackId);
            track.setName(parseTrackTitle(row, this.isSplit));
            track.setPlayTime(parsePlayTime(row));
            int trackNumber = parseTrackNumber(row);
            track.setTrackNumber(trackNumber);
            if (foundFirstFirstTrack && trackNumber == 1) {
                counter++;
            } else if (trackNumber == 1) {
                foundFirstFirstTrack = true;
            }
            track.setDiscNumber(counter);
//			because otherwise the bandName is always the same
            if (this.isSplit) {
                track.setBandName(parseBandName(row));
            }
            track.setInstrumental(parseIsInstrumental(row));
            if (this.loadLyrics && row.getElementById("lyricsButton" + trackIdStr) != null) {
                lazyInitLatch(rows.size());
                parseLyrics2(row, trackId, track);
            } else {
                signalDoneCountDown();
            }
            trackList.add(track);

        }
        waitUntilEverythingIsDone(rows.size());
        return trackList.toArray(new Track[trackList.size()]);
    }

Replace Generic With Diamond ArrayList<Track> with ArrayList<> in method public parse() : Track[] from class com.github.loki.afro.metallum.core.parser.site.helper.disc.DiscSiteTrackParser


    private List<Disc> getDiscList(final Band band) {
        List<Disc> discList;
        if (this.mainMap.containsKey(band)) {
            discList = this.mainMap.get(band);
        } else {
            discList = new ArrayList<>();
        }

        return discList;
    }

    private List<Disc> getDiscList(final Band band) {
        List<Disc> discList;
        if (this.mainMap.containsKey(band)) {
            discList = this.mainMap.get(band);
        } else {
            discList = new ArrayList<Disc>();
        }

        return discList;
    }

Replace Generic With Diamond ArrayList<Disc> with ArrayList<> in method private getDiscList(band Band) : List<Disc> from class com.github.loki.afro.metallum.core.parser.site.helper.label.ReleaseParser


    public void addSimilarArtists(final Band band, final int score) {
        List<Band> bandListFromMap = this.similarArtist.get(score);
        if (bandListFromMap == null) {
            bandListFromMap = new ArrayList<>();
            bandListFromMap.add(band);
        } else {
            bandListFromMap.add(band);
        }
        this.similarArtist.put(score, bandListFromMap);
    }

    public void addSimilarArtists(final Band band, final int score) {
        List<Band> bandListFromMap = this.similarArtist.get(score);
        if (bandListFromMap == null) {
            bandListFromMap = new ArrayList<Band>();
            bandListFromMap.add(band);
        } else {
            bandListFromMap.add(band);
        }
        this.similarArtist.put(score, bandListFromMap);
    }

Replace Generic With Diamond ArrayList<Band> with ArrayList<> in method public addSimilarArtists(band Band, score int) : void from class com.github.loki.afro.metallum.entity.Band


    public final List<Review> getReviews() {
        final List<Review> reviewList = new ArrayList<>();
        for (final Disc disc : this.discs) {
            reviewList.addAll(disc.getReviews());
        }
        return reviewList;
    }

    public final List<Review> getReviews() {
        final List<Review> reviewList = new ArrayList<Review>();
        for (final Disc disc : this.discs) {
            reviewList.addAll(disc.getReviews());
        }
        return reviewList;
    }

Replace Generic With Diamond ArrayList<Review> with ArrayList<> in method public getReviews() : List<Review> from class com.github.loki.afro.metallum.entity.Band


    public List<Link> getLinks() {
        List<Link> linkList = new ArrayList<>();
        linkList.addAll(this.officialLinks);
        linkList.addAll(this.officialMerchLinks);
        linkList.addAll(this.unofficialLinks);
        linkList.addAll(this.labelLinks);
        linkList.addAll(this.tablatureLinks);
        return linkList;
    }

    public List<Link> getLinks() {
        List<Link> linkList = new ArrayList<Link>();
        linkList.addAll(this.officialLinks);
        linkList.addAll(this.officialMerchLinks);
        linkList.addAll(this.unofficialLinks);
        linkList.addAll(this.labelLinks);
        linkList.addAll(this.tablatureLinks);
        return linkList;
    }

Replace Generic With Diamond ArrayList<Link> with ArrayList<> in method public getLinks() : List<Link> from class com.github.loki.afro.metallum.entity.Band


    public List<Track> getTrackListOnDisc(final int discNumber) {
        final List<Track> trackListByDiscNumber = new ArrayList<>();
        for (final Track track : this.trackList) {
            if (track.getDiscNumber() == discNumber) {
                trackListByDiscNumber.add(track);
            }

        }
        return trackListByDiscNumber;
    }

    public List<Track> getTrackListOnDisc(final int discNumber) {
        final List<Track> trackListByDiscNumber = new ArrayList<Track>();
        for (final Track track : this.trackList) {
            if (track.getDiscNumber() == discNumber) {
                trackListByDiscNumber.add(track);
            }

        }
        return trackListByDiscNumber;
    }

Replace Generic With Diamond ArrayList<Track> with ArrayList<> in method public getTrackListOnDisc(discNumber int) : List<Track> from class com.github.loki.afro.metallum.entity.Disc


    public AbstractSearchService(final int objectsToLoad) {
        this.resultMap = new TreeMap<>();
        this.objectToLoad = objectsToLoad;
    }

    public AbstractSearchService(final int objectsToLoad) {
        this.resultMap = new TreeMap<SearchRelevance, List<T>>();
        this.objectToLoad = objectsToLoad;
    }

Replace Generic With Diamond TreeMap<SearchRelevance,List<T>> with TreeMap<> in method public AbstractSearchService(objectsToLoad int) from class com.github.loki.afro.metallum.search.AbstractSearchService


    public AbstractSearchService() {
        this.resultMap = new TreeMap<>();
    }

    public AbstractSearchService() {
        this.resultMap = new TreeMap<SearchRelevance, List<T>>();
    }

Replace Generic With Diamond TreeMap<SearchRelevance,List<T>> with TreeMap<> in method public AbstractSearchService() from class com.github.loki.afro.metallum.search.AbstractSearchService


/**
     * This method, finally, does the search.

     * The specific query will be executed and you will get a result as List

     * which contains the specific elements which were found by the query.

     *

     * If you used the set the id in the query, it will download directly the entity and parse it.

     * So you are save traffic.

     *

     * Note that you can also archive the result as map, just call the Method getResultAsMap.
     *
     * @param query the specific query
     * @return a List with the entities
     * @throws MetallumException if parsing or downloading failed.
     */
    public List<T> performSearch(final AbstractSearchQuery<T> query) throws MetallumException {
        query.setSpecialFieldsInParser(this.parser);
        if (query.searchObject.getId() == 0) {
            parseSearchResults(query);
        } else {
            // direct id
            final List<T> list = new ArrayList<>();
            list.add(query.searchObject);
            this.resultMap.put(new SearchRelevance(0d), list);

        }
        loadResults(query);
        return getResultAsList();
    }

/**
     * This method, finally, does the search.

     * The specific query will be executed and you will get a result as List

     * which contains the specific elements which were found by the query.

     *

     * If you used the set the id in the query, it will download directly the entity and parse it.

     * So you are save traffic.

     *

     * Note that you can also archive the result as map, just call the Method getResultAsMap.
     *
     * @param query the specific query
     * @return a List with the entities
     * @throws MetallumException if parsing or downloading failed.
     */
    public List<T> performSearch(final AbstractSearchQuery<T> query) throws MetallumException {
        query.setSpecialFieldsInParser(this.parser);
        if (query.searchObject.getId() == 0) {
            parseSearchResults(query);
        } else {
            // direct id
            final List<T> list = new ArrayList<T>();
            list.add(query.searchObject);
            this.resultMap.put(new SearchRelevance(0d), list);

        }
        loadResults(query);
        return getResultAsList();
    }

Replace Generic With Diamond ArrayList<T> with ArrayList<> in method public performSearch(query AbstractSearchQuery<T>) : List<T> from class com.github.loki.afro.metallum.search.AbstractSearchService


    private final List<T> getFirstList() {
        if (this.resultMap.isEmpty()) {
            return new ArrayList<>();
        }
        return this.resultMap.get(this.resultMap.firstKey());
    }

    private final List<T> getFirstList() {
        if (this.resultMap.isEmpty()) {
            return new ArrayList<T>();
        }
        return this.resultMap.get(this.resultMap.firstKey());
    }

Replace Generic With Diamond ArrayList<T> with ArrayList<> in method private getFirstList() : List<T> from class com.github.loki.afro.metallum.search.AbstractSearchService


    /**
     * This list contains all elements which were parsed.<br>
     * This list is equal to the one you can get via the performSearch() method.
     *
     * @return a List representation of the specific entities.
     */
    public final List<T> getResultAsList() {
        final List<T> listToReturn = new ArrayList<>();
        for (final List<T> listWithSearchObjects : this.resultMap.values()) {
            listToReturn.addAll(listWithSearchObjects);
        }
        return listToReturn;
    }

    /**
     * This list contains all elements which were parsed.<br>
     * This list is equal to the one you can get via the performSearch() method.
     *
     * @return a List representation of the specific entities.
     */
    public final List<T> getResultAsList() {
        final List<T> listToReturn = new ArrayList<T>();
        for (final List<T> listWithSearchObjects : this.resultMap.values()) {
            listToReturn.addAll(listWithSearchObjects);
        }
        return listToReturn;
    }

Replace Generic With Diamond ArrayList<T> with ArrayList<> in method public getResultAsList() : List<T> from class com.github.loki.afro.metallum.search.AbstractSearchService


    /**
     * Loads the specific entities into the map. If objectToLoad is 5 you'll
     * have 5 requests. But only for the SearchRelevance with the highest value.
     */
    private final void loadResults(final AbstractSearchQuery<T> query) throws MetallumException {
        if (!this.resultMap.isEmpty()) {
            final SearchRelevance key = this.resultMap.firstKey();
            final CopyOnWriteArrayList<T> entityListFromMap = new CopyOnWriteArrayList<>(this.resultMap.get(key));
            int i = 0;
            for (final T entity : entityListFromMap) {
                if (i < this.objectToLoad) {
                    entityListFromMap.set(i, getParsedEntity(entity));
                } else {
                    entityListFromMap.set(i, (entity));
                }
                i++;
            }
            removeAndPutNewKey(key, entityListFromMap);
        }
        this.resultMap = query.enrichParsedEntity(this.resultMap);
    }

    /**
     * Loads the specific entities into the map. If objectToLoad is 5 you'll
     * have 5 requests. But only for the SearchRelevance with the highest value.
     */
    private final void loadResults(final AbstractSearchQuery<T> query) throws MetallumException {
        if (!this.resultMap.isEmpty()) {
            final SearchRelevance key = this.resultMap.firstKey();
            final CopyOnWriteArrayList<T> entityListFromMap = new CopyOnWriteArrayList<T>(this.resultMap.get(key));
            int i = 0;
            for (final T entity : entityListFromMap) {
                if (i < this.objectToLoad) {
                    entityListFromMap.set(i, getParsedEntity(entity));
                } else {
                    entityListFromMap.set(i, (entity));
                }
                i++;
            }
            removeAndPutNewKey(key, entityListFromMap);
        }
        this.resultMap = query.enrichParsedEntity(this.resultMap);
    }

Replace Generic With Diamond CopyOnWriteArrayList<T> with CopyOnWriteArrayList<> in method private loadResults(query AbstractSearchQuery<T>) : void from class com.github.loki.afro.metallum.search.AbstractSearchService


    @Ignore
    public void test() throws MetallumException {
        List<String> stringList = new ArrayList<>();
        stringList.add("Death Metal");
        stringList.add("Death Metal");
        // stringList.add("Black Metal");
        for (String genreName : stringList) {
            GenreSearchQuery query = new GenreSearchQuery();
            GenreSearchService service = new GenreSearchService();
            service.setObjectsToLoad(5);
            query.setGenre(genreName);
            service.performSearch(query);
            Assert.assertFalse(service.getResultAsList().isEmpty());
        }

    }

    @Ignore
    public void test() throws MetallumException {
        List<String> stringList = new ArrayList<String>();
        stringList.add("Death Metal");
        stringList.add("Death Metal");
        // stringList.add("Black Metal");
        for (String genreName : stringList) {
            GenreSearchQuery query = new GenreSearchQuery();
            GenreSearchService service = new GenreSearchService();
            service.setObjectsToLoad(5);
            query.setGenre(genreName);
            service.performSearch(query);
            Assert.assertFalse(service.getResultAsList().isEmpty());
        }

    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public test() : void from class com.github.loki.afro.metallum.example.GenreSearchExampleTest


    @Ignore
    public void test() throws MetallumException {
        List<String> stringList = new ArrayList<>();
        stringList.add("Deathlike Silence");
        stringList.add("Apparitia Recordings");
        stringList.add("Metal Blade Records");
        stringList.add("Nuclear");
        stringList.add("Century Media Records");
        stringList.add("");
        for (String labelName : stringList) {
            // System.out.println("searching with: " + labelName);
            LabelSearchQuery query = new LabelSearchQuery();
            LabelSearchService service = new LabelSearchService();
            query.setLabelName(labelName);
            service.performSearch(query);
            Assert.assertFalse(service.getResultAsList().isEmpty());
        }

    }

    @Ignore
    public void test() throws MetallumException {
        List<String> stringList = new ArrayList<String>();
        stringList.add("Deathlike Silence");
        stringList.add("Apparitia Recordings");
        stringList.add("Metal Blade Records");
        stringList.add("Nuclear");
        stringList.add("Century Media Records");
        stringList.add("");
        for (String labelName : stringList) {
            // System.out.println("searching with: " + labelName);
            LabelSearchQuery query = new LabelSearchQuery();
            LabelSearchService service = new LabelSearchService();
            query.setLabelName(labelName);
            service.performSearch(query);
            Assert.assertFalse(service.getResultAsList().isEmpty());
        }

    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public test() : void from class com.github.loki.afro.metallum.example.LabelSearchExampleTest


    @Ignore
    public void test() throws MetallumException {

        List<String> stringList = new ArrayList<>();
        stringList.add("Love");
        stringList.add("Sex");
        for (String lyricalThemes : stringList) {
            LyricalThemesSearchQuery query = new LyricalThemesSearchQuery();
            LyricalThemesSearchService service = new LyricalThemesSearchService();
            query.setLyricalThemes(lyricalThemes);
            service.performSearch(query);
            Assert.assertFalse(service.getResultAsList().isEmpty());
        }

    }

    @Ignore
    public void test() throws MetallumException {

        List<String> stringList = new ArrayList<String>();
        stringList.add("Love");
        stringList.add("Sex");
        for (String lyricalThemes : stringList) {
            LyricalThemesSearchQuery query = new LyricalThemesSearchQuery();
            LyricalThemesSearchService service = new LyricalThemesSearchService();
            query.setLyricalThemes(lyricalThemes);
            service.performSearch(query);
            Assert.assertFalse(service.getResultAsList().isEmpty());
        }

    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public test() : void from class com.github.loki.afro.metallum.example.LyricalThemesExampleTest


    @Ignore
    public void test() throws MetallumException {

        List<String> stringList = new ArrayList<>();
        stringList.add("Kerry King");
        stringList.add("");
        stringList.add("Fenriz");
        stringList.add("Bruce Dickinson");
        stringList.add("Mick Kenney");
        stringList.add("Joel Lindholm");
        stringList.add("Varg Vikernes");
        for (String memberName : stringList) {
            // System.out.println("searching with: " + memberName);
            MemberSearchQuery query = new MemberSearchQuery();
            MemberSearchService service = new MemberSearchService();
            query.setMemberName(memberName);
            service.performSearch(query);
            Assert.assertFalse(service.getResultAsList().isEmpty());
        }

    }

    @Ignore
    public void test() throws MetallumException {

        List<String> stringList = new ArrayList<String>();
        stringList.add("Kerry King");
        stringList.add("");
        stringList.add("Fenriz");
        stringList.add("Bruce Dickinson");
        stringList.add("Mick Kenney");
        stringList.add("Joel Lindholm");
        stringList.add("Varg Vikernes");
        for (String memberName : stringList) {
            // System.out.println("searching with: " + memberName);
            MemberSearchQuery query = new MemberSearchQuery();
            MemberSearchService service = new MemberSearchService();
            query.setMemberName(memberName);
            service.performSearch(query);
            Assert.assertFalse(service.getResultAsList().isEmpty());
        }

    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public test() : void from class com.github.loki.afro.metallum.example.MemberSearchExampleTest


	/**
	 * Verifies that writer is registered as service under the name "file".
	 *
	 * @throws IOException
	 *             Failed creating temporary file
	 */
	@Test
	public void isRegistered() throws IOException {
		String file = FileSystem.createTemporaryFile();
		Writer writer = new ServiceLoader<>(Writer.class, Map.class).create("file", singletonMap("file", file));
		assertThat(writer).isInstanceOf(FileWriter.class);
	}

	/**
	 * Verifies that writer is registered as service under the name "file".
	 *
	 * @throws IOException
	 *             Failed creating temporary file
	 */
	@Test
	public void isRegistered() throws IOException {
		String file = FileSystem.createTemporaryFile();
		Writer writer = new ServiceLoader<Writer>(Writer.class, Map.class).create("file", singletonMap("file", file));
		assertThat(writer).isInstanceOf(FileWriter.class);
	}

Replace Generic With Diamond ServiceLoader<Writer> with ServiceLoader<> in method public isRegistered() : void from class org.tinylog.writers.FileWriterTest


		/**
		 * Verifies that logging provider is registered under the name "tinylog".
		 */
		@Test
		public void isRegistered() {
			LoggingProvider provider = new ServiceLoader<>(LoggingProvider.class).create("tinylog");
			assertThat(provider).isInstanceOf(TinylogLoggingProvider.class);
		}

		/**
		 * Verifies that logging provider is registered under the name "tinylog".
		 */
		@Test
		public void isRegistered() {
			LoggingProvider provider = new ServiceLoader<LoggingProvider>(LoggingProvider.class).create("tinylog");
			assertThat(provider).isInstanceOf(TinylogLoggingProvider.class);
		}

Replace Generic With Diamond ServiceLoader<LoggingProvider> with ServiceLoader<> in method public isRegistered() : void from class org.tinylog.core.TinylogLoggingProviderTest.ServiceRegistration


	/**
	 * Verifies that writer is registered as service under the name "console".
	 */
	@Test
	public void isRegistered() {
		Writer writer = new ServiceLoader<>(Writer.class, Map.class).create("console", emptyMap());
		assertThat(writer).isInstanceOf(ConsoleWriter.class);
	}

	/**
	 * Verifies that writer is registered as service under the name "console".
	 */
	@Test
	public void isRegistered() {
		Writer writer = new ServiceLoader<Writer>(Writer.class, Map.class).create("console", emptyMap());
		assertThat(writer).isInstanceOf(ConsoleWriter.class);
	}

Replace Generic With Diamond ServiceLoader<Writer> with ServiceLoader<> in method public isRegistered() : void from class org.tinylog.writers.ConsoleWriterTest


    static Map<String, String> loadNamespaces(String string, Log log) {
        Map<String, String> namespaceMap = new HashMap<>();

        if(string != null) {
            for(String part: string.split(",")) {
                String prefix = part.substring(0, part.indexOf("="));
                String uri = part.substring(part.indexOf("=") + 1);
                namespaceMap.put(prefix, uri);
                log.debug("Loaded namespace '{}={}'", prefix, uri);
            }
        }

        log.debug("Loaded {} namespaces", namespaceMap.size());
        return namespaceMap;
    }

    static Map<String, String> loadNamespaces(String string, Log log) {
        Map<String, String> namespaceMap = new HashMap<String,  String>();

        if(string != null) {
            for(String part: string.split(",")) {
                String prefix = part.substring(0, part.indexOf("="));
                String uri = part.substring(part.indexOf("=") + 1);
                namespaceMap.put(prefix, uri);
                log.debug("Loaded namespace '{}={}'", prefix, uri);
            }
        }

        log.debug("Loaded {} namespaces", namespaceMap.size());
        return namespaceMap;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method package loadNamespaces(string String, log Log) : Map<String,String> from class com.emarte.regurgitator.extensions.NamespaceLoader


    static <T> Enumerable<T> of(Iterable<T> iterable) {
        return new Enumerable<>() {
            @Override
            public void forEach(Consumer<? super T> action) {
                iterable.forEach(action);
            }

            @Override
            public Iterator<T> iterator() {
                return iterable.iterator();
            }

            @Override
            public Spliterator<T> spliterator() {
                return iterable.spliterator();
            }
        };
    }

    static <T> Enumerable<T> of(Iterable<T> iterable) {
        return new Enumerable<T>() {
            @Override
            public void forEach(Consumer<? super T> action) {
                iterable.forEach(action);
            }

            @Override
            public Iterator<T> iterator() {
                return iterable.iterator();
            }

            @Override
            public Spliterator<T> spliterator() {
                return iterable.spliterator();
            }
        };
    }

Replace Generic With Diamond Enumerable<T> with Enumerable<> in method public of(iterable Iterable<T>) : Enumerable<T> from class adventofcode.utils.Enumerable


    /**
     * write dissatisfaction values to specified h5 file
     * @param p_name name of h5 file
     * @param p_dissVals dissatisfaction values
     * @param p_chairName chair calling the method
     * @return this
     */

    public final CDataWriter writeDissVals( final String p_name, final AtomicDoubleArray p_dissVals, final String p_chairName )
    {
        try ( final hdf5.H5File l_file = new hdf5.H5File( p_name, hdf5.H5F_ACC_RDWR ); )
        {

            final double[] l_buf = new double[p_dissVals.length()];

            for ( int i = 0; i < p_dissVals.length(); i++ )
            {
                l_buf[i] = p_dissVals.get( i );
            }

            final hdf5.DataSet l_dataSet = new hdf5.DataSet(
                l_file.asCommonFG().openGroup( p_chairName ).asCommonFG().createDataSet(
                    "diss values", new hdf5.DataType( hdf5.PredType.NATIVE_DOUBLE() ), new hdf5.DataSpace( 2, new long[]{1, p_dissVals.length()} ),
                    new hdf5.DSetCreatPropList()
                )
            );

            l_dataSet.write( new DoublePointer( l_buf ), new hdf5.DataType( hdf5.PredType.NATIVE_DOUBLE() ) );
        }

        return this;

    }

    /**
     * write dissatisfaction values to specified h5 file
     * @param p_name name of h5 file
     * @param p_dissVals dissatisfaction values
     * @param p_chairName chair calling the method
     * @return this
     */

    public final CDataWriter writeDissVals( final String p_name, final AtomicDoubleArray p_dissVals, final String p_chairName )
    {
        final hdf5.H5File l_file = new hdf5.H5File();
        l_file.openFile( p_name, hdf5.H5F_ACC_RDWR );

        try
        {

            final double[] l_buf = new double[p_dissVals.length()];

            for ( int i = 0; i < p_dissVals.length(); i++ )
            {
                l_buf[i] = p_dissVals.get( i );
            }

            final hdf5.DataSet l_dataSet = new hdf5.DataSet(
                l_file.asCommonFG().openGroup( p_chairName ).asCommonFG().createDataSet(
                    "diss values", new hdf5.DataType( hdf5.PredType.NATIVE_DOUBLE() ), new hdf5.DataSpace( 2, new long[]{1, p_dissVals.length()} ),
                    new hdf5.DSetCreatPropList()
                )
            );

            l_dataSet.write( new DoublePointer( l_buf ), new hdf5.DataType( hdf5.PredType.NATIVE_DOUBLE() ) );
        }
        finally
        {
            l_file.close();
        }

        return this;

    }

Try With Resources try(final hdf5.H5File l_file=new hdf5.H5File(p_name,hdf5.H5F_ACC_RDWR)) in method public writeDissVals(p_name String, p_dissVals AtomicDoubleArray, p_chairName String) : CDataWriter from class org.lightvoting.simulation.statistics.CDataWriter


    /**
     * write data to file
     * @param p_fileName name of h5 file
     * @param p_run number of simulation run
     * @param p_config simulation config (grouping and protocol)
     * @param p_chair chair calling the method
     * @param p_iteration number of iteration
     * @param p_dissVals dissatisfaction values
     * @return this
     */

    public final CDataWriter writeDataVector( final String p_fileName, final int p_run, final String p_config, final CChairAgent p_chair, final int p_iteration,
                                              final AtomicDoubleArray p_dissVals
    )
    {

        final String l_currentGroup = "group " + p_chair.getGroupID();

        System.out.println( "CDataWriter: " + p_dissVals  );

        try ( final hdf5.H5File l_file = new hdf5.H5File( p_fileName, hdf5.H5F_ACC_RDWR ); )
        {

       //     System.out.println( "Name of group: " + p_run + "/" +  p_config + "/" + l_currentGroup + "/" + p_iteration );

            final hdf5.Group l_group;

            l_group = l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( p_config  )
                                          .asCommonFG().openGroup( l_currentGroup ).asCommonFG().createGroup( String.valueOf( p_iteration ) );

            final hdf5.DataSet l_dataSet;

            if ( l_group.asCommonFG().getNumObjs() == 0 )
                l_dataSet = new hdf5.DataSet(
                l_group.asCommonFG().createDataSet( "dissVals", new hdf5.DataType( hdf5.PredType.NATIVE_DOUBLE() ),
                                                    new hdf5.DataSpace( 2, new long[]{p_dissVals.length(), 1} ), new hdf5.DSetCreatPropList()
                )
            );
            else
                l_dataSet = new hdf5.DataSet(
                    l_group.asCommonFG().openDataSet( "dissVals" )
                );

            final double[] l_buf = new double[p_dissVals.length()];

            for ( int i = 0; i < p_dissVals.length(); i++ )
            {
                System.out.println( " Setting buf[" + i + "] to " + p_dissVals.get( i ) );
                l_buf[i] = p_dissVals.get( i );
            }

            l_dataSet.write( new DoublePointer( l_buf ), new hdf5.DataType( hdf5.PredType.NATIVE_DOUBLE() ) );

            // write # groups

            final hdf5.Group l_countGroup = l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( p_config  ).asCommonFG().openGroup( "groups" );

            final hdf5.DataSet l_countDataSet = l_countGroup.asCommonFG().openDataSet( "group count" );

            final int[] l_countBuf = new int[1];
            l_countBuf[0] = s_groups;
            l_countDataSet.write( new IntPointer( l_countBuf ), new hdf5.DataType( hdf5.PredType.NATIVE_INT() ) );

            l_file.close();

        }
        catch ( final Exception l_ex )
        {
            System.out.println( "Error occurred at group: " + p_run + "/" +  p_config + "/" + l_currentGroup + "/" + p_iteration );
            l_ex.printStackTrace();
        }

        return this;
    }

    /**
     * write data to file
     * @param p_fileName name of h5 file
     * @param p_run number of simulation run
     * @param p_config simulation config (grouping and protocol)
     * @param p_chair chair calling the method
     * @param p_iteration number of iteration
     * @param p_dissVals dissatisfaction values
     * @return this
     */

    public final CDataWriter writeDataVector( final String p_fileName, final int p_run, final String p_config, final CChairAgent p_chair, final int p_iteration,
                                              final AtomicDoubleArray p_dissVals
    )
    {

        final String l_currentGroup = "group " + p_chair.getGroupID();

        System.out.println( "CDataWriter: " + p_dissVals  );

        final hdf5.H5File l_file = new hdf5.H5File();
        l_file.openFile( p_fileName, hdf5.H5F_ACC_RDWR );

        try
        {

       //     System.out.println( "Name of group: " + p_run + "/" +  p_config + "/" + l_currentGroup + "/" + p_iteration );

            final hdf5.Group l_group;

            l_group = l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( p_config  )
                                          .asCommonFG().openGroup( l_currentGroup ).asCommonFG().createGroup( String.valueOf( p_iteration ) );

            final hdf5.DataSet l_dataSet;

            if ( l_group.asCommonFG().getNumObjs() == 0 )
                l_dataSet = new hdf5.DataSet(
                l_group.asCommonFG().createDataSet( "dissVals", new hdf5.DataType( hdf5.PredType.NATIVE_DOUBLE() ),
                                                    new hdf5.DataSpace( 2, new long[]{p_dissVals.length(), 1} ), new hdf5.DSetCreatPropList()
                )
            );
            else
                l_dataSet = new hdf5.DataSet(
                    l_group.asCommonFG().openDataSet( "dissVals" )
                );

            final double[] l_buf = new double[p_dissVals.length()];

            for ( int i = 0; i < p_dissVals.length(); i++ )
            {
                System.out.println( " Setting buf[" + i + "] to " + p_dissVals.get( i ) );
                l_buf[i] = p_dissVals.get( i );
            }

            l_dataSet.write( new DoublePointer( l_buf ), new hdf5.DataType( hdf5.PredType.NATIVE_DOUBLE() ) );

            // write # groups

            final hdf5.Group l_countGroup = l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( p_config  ).asCommonFG().openGroup( "groups" );

            final hdf5.DataSet l_countDataSet = l_countGroup.asCommonFG().openDataSet( "group count" );

            final int[] l_countBuf = new int[1];
            l_countBuf[0] = s_groups;
            l_countDataSet.write( new IntPointer( l_countBuf ), new hdf5.DataType( hdf5.PredType.NATIVE_INT() ) );

            l_file.close();

        }
        catch ( final Exception l_ex )
        {
            System.out.println( "Error occurred at group: " + p_run + "/" +  p_config + "/" + l_currentGroup + "/" + p_iteration );
            l_ex.printStackTrace();
        }
        finally
        {
            l_file.close();
        }

        return this;
    }

Try With Resources try(final hdf5.H5File l_file=new hdf5.H5File(p_fileName,hdf5.H5F_ACC_RDWR)) in method public writeDataVector(p_fileName String, p_run int, p_config String, p_chair CChairAgent, p_iteration int, p_dissVals AtomicDoubleArray) : CDataWriter from class org.lightvoting.simulation.statistics.CDataWriter


    /**
     * create group in hdf5 for run
     * @param p_name name of hdf5 file
     * @param p_run run id
     * @param p_configStr config string
     * @return this
     */

    public final CDataWriter setRun( final String p_name, final int p_run, final int p_configNum, final String p_configStr )
    {
        try ( final hdf5.H5File l_file = new hdf5.H5File( p_name, hdf5.H5F_ACC_RDWR ); )
        {
            l_file.asCommonFG().createGroup( String.valueOf( p_run ) );
            l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().createGroup( "configs" );
            final hdf5.DataSet l_configDataSet = l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( "configs" ).asCommonFG()
                                                       .createDataSet( "config num", new hdf5.DataType( hdf5.PredType.NATIVE_INT() ),
                                                                       new hdf5.DataSpace( 2, new long[]{1, 1} )
                                                       );

            final int[] l_configBuf = new int[1];
            l_configBuf[0] = p_configNum;
            l_configDataSet.write( new IntPointer( l_configBuf ), new hdf5.DataType( hdf5.PredType.NATIVE_INT() ) );

            l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().createGroup( "confignames" );
            final hdf5.PredType l_predType = hdf5.PredType.C_S1();
            l_predType.setSize( 256 );

            final hdf5.DataSet l_configNamesDataSet = l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( "confignames" )
                                                            .asCommonFG()
                                                            .createDataSet( "config names", l_predType,
                                                                            new hdf5.DataSpace( 1, new long[]{1} )
                                                            );

            l_configNamesDataSet.write( new BytePointer( p_configStr ), new hdf5.DataType( hdf5.PredType.C_S1() ) );

            s_groups = 0;
        }

        return this;
    }

    /**
     * create group in hdf5 for run
     * @param p_name name of hdf5 file
     * @param p_run run id
     * @param p_configStr config string
     * @return this
     */

    public final CDataWriter setRun( final String p_name, final int p_run, final int p_configNum, final String p_configStr )
    {
        final hdf5.H5File l_file = new hdf5.H5File();
        l_file.openFile( p_name, hdf5.H5F_ACC_RDWR );

        try
        {
            l_file.asCommonFG().createGroup( String.valueOf( p_run ) );
            l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().createGroup( "configs" );
            final hdf5.DataSet l_configDataSet = l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( "configs" ).asCommonFG()
                                                       .createDataSet( "config num", new hdf5.DataType( hdf5.PredType.NATIVE_INT() ),
                                                                       new hdf5.DataSpace( 2, new long[]{1, 1} )
                                                       );

            final int[] l_configBuf = new int[1];
            l_configBuf[0] = p_configNum;
            l_configDataSet.write( new IntPointer( l_configBuf ), new hdf5.DataType( hdf5.PredType.NATIVE_INT() ) );

            l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().createGroup( "confignames" );
            final hdf5.PredType l_predType = hdf5.PredType.C_S1();
            l_predType.setSize( 256 );

            final hdf5.DataSet l_configNamesDataSet = l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( "confignames" )
                                                            .asCommonFG()
                                                            .createDataSet( "config names", l_predType,
                                                                            new hdf5.DataSpace( 1, new long[]{1} )
                                                            );

            l_configNamesDataSet.write( new BytePointer( p_configStr ), new hdf5.DataType( hdf5.PredType.C_S1() ) );

            s_groups = 0;
        }
        finally
        {
            l_file.close();
        }

        return this;
    }

Try With Resources try(final hdf5.H5File l_file=new hdf5.H5File(p_name,hdf5.H5F_ACC_RDWR)) in method public setRun(p_name String, p_run int, p_configNum int, p_configStr String) : CDataWriter from class org.lightvoting.simulation.statistics.CDataWriter


    /**
     * set group for configuration in hdf5 file
     * @param p_fileName name of hdf5 file
     * @param p_run run id
     * @param p_conf config id
     * @return this
     */

    public final CDataWriter setConf( final String p_fileName, final int p_run, final String p_conf )
    {
        try ( final hdf5.H5File l_file = new hdf5.H5File( p_fileName, hdf5.H5F_ACC_RDWR ); )
        {

            l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().createGroup( p_conf );

            s_groups = 0;
            l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( p_conf ).asCommonFG().createGroup( "groups" );
            l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( p_conf ).asCommonFG().openGroup( "groups" ).asCommonFG()
                  .createDataSet( "group count", new hdf5.DataType( hdf5.PredType.NATIVE_INT() ), new hdf5.DataSpace( 2, new long[]{1, 1} ),
                                  new hdf5.DSetCreatPropList()
            );
        }

        return this;
    }

    /**
     * set group for configuration in hdf5 file
     * @param p_fileName name of hdf5 file
     * @param p_run run id
     * @param p_conf config id
     * @return this
     */

    public final CDataWriter setConf( final String p_fileName, final int p_run, final String p_conf )
    {
        final hdf5.H5File l_file = new hdf5.H5File();
        l_file.openFile( p_fileName, hdf5.H5F_ACC_RDWR );

        try
        {

            l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().createGroup( p_conf );

            s_groups = 0;
            l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( p_conf ).asCommonFG().createGroup( "groups" );
            l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( p_conf ).asCommonFG().openGroup( "groups" ).asCommonFG()
                  .createDataSet( "group count", new hdf5.DataType( hdf5.PredType.NATIVE_INT() ), new hdf5.DataSpace( 2, new long[]{1, 1} ),
                                  new hdf5.DSetCreatPropList()
            );
        }
        finally
        {
            l_file.close();
        }

        return this;
    }

Try With Resources try(final hdf5.H5File l_file=new hdf5.H5File(p_fileName,hdf5.H5F_ACC_RDWR)) in method public setConf(p_fileName String, p_run int, p_conf String) : CDataWriter from class org.lightvoting.simulation.statistics.CDataWriter


    /**
     * set # runs
     * @param p_name name of hdf5 file
     * @param p_runs number of runs
     * @return this
     */

    public final CDataWriter setRunNum( final String p_name, final int p_runs )
    {

        try ( final hdf5.H5File l_file = new hdf5.H5File( p_name, hdf5.H5F_ACC_RDWR ); )
        {
            l_file.asCommonFG().createGroup( "runs" );
            final hdf5.DataSet l_runDataSet = l_file.asCommonFG().openGroup( String.valueOf( "runs" ) ).asCommonFG()
                                                    .createDataSet( "run num", new hdf5.DataType( hdf5.PredType.NATIVE_INT() ),
                                                                    new hdf5.DataSpace( 2, new long[]{1, 1} )
                                                    );

            final int[] l_runBuf = new int[1];
            l_runBuf[0] = p_runs;
            l_runDataSet.write( new IntPointer( l_runBuf ), new hdf5.DataType( hdf5.PredType.NATIVE_INT() ) );
        }

        return this;
    }

    /**
     * set # runs
     * @param p_name name of hdf5 file
     * @param p_runs number of runs
     * @return this
     */

    public final CDataWriter setRunNum( final String p_name, final int p_runs )
    {

        final hdf5.H5File l_file = new hdf5.H5File();
        l_file.openFile( p_name, hdf5.H5F_ACC_RDWR );

        try
        {
            l_file.asCommonFG().createGroup( "runs" );
            final hdf5.DataSet l_runDataSet = l_file.asCommonFG().openGroup( String.valueOf( "runs" ) ).asCommonFG()
                                                    .createDataSet( "run num", new hdf5.DataType( hdf5.PredType.NATIVE_INT() ),
                                                                    new hdf5.DataSpace( 2, new long[]{1, 1} )
                                                    );

            final int[] l_runBuf = new int[1];
            l_runBuf[0] = p_runs;
            l_runDataSet.write( new IntPointer( l_runBuf ), new hdf5.DataType( hdf5.PredType.NATIVE_INT() ) );
        }
        finally
        {
            l_file.close();
        }

        return this;
    }

Try With Resources try(final hdf5.H5File l_file=new hdf5.H5File(p_name,hdf5.H5F_ACC_RDWR)) in method public setRunNum(p_name String, p_runs int) : CDataWriter from class org.lightvoting.simulation.statistics.CDataWriter


    /**
     * set info on new traveller group in h5
     * @param p_run run number
     * @param p_config config name
     * @param p_name file name
     * @param p_groupNum group ID
     * @return this
     */

    public final CDataWriter setGroup( final int p_run, final String p_config, final String p_name, final int p_groupNum )
    {
        try ( final hdf5.H5File l_file = new hdf5.H5File( p_name, hdf5.H5F_ACC_RDWR ); )
        {

            final String l_currentGroup = "group " + p_groupNum;
            System.out.println( "XXXXX creating new group " + l_currentGroup );

            l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( p_config )
                  .asCommonFG().createGroup( l_currentGroup );

            s_groups++;
        }

        return this;

    }

    /**
     * set info on new traveller group in h5
     * @param p_run run number
     * @param p_config config name
     * @param p_name file name
     * @param p_groupNum group ID
     * @return this
     */

    public final CDataWriter setGroup( final int p_run, final String p_config, final String p_name, final int p_groupNum )
    {
        final hdf5.H5File l_file = new hdf5.H5File();
        l_file.openFile( p_name, hdf5.H5F_ACC_RDWR );

        try
        {

            final String l_currentGroup = "group " + p_groupNum;
            System.out.println( "XXXXX creating new group " + l_currentGroup );

            l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( p_config )
                  .asCommonFG().createGroup( l_currentGroup );

            s_groups++;
        }
        finally
        {
            l_file.close();
        }

        return this;

    }

Try With Resources try(final hdf5.H5File l_file=new hdf5.H5File(p_name,hdf5.H5F_ACC_RDWR)) in method public setGroup(p_run int, p_config String, p_name String, p_groupNum int) : CDataWriter from class org.lightvoting.simulation.statistics.CDataWriter


    /**
     * write number of last iteration
     * @param p_fileName name of h5 file
     * @param p_run number of simulation run
     * @param p_config simulation config (grouping and protocol)
     * @param p_chair chair calling the method
     * @param p_iteration number of iteration
     * @return this
     */

    public CDataWriter writeLastIteration( final String p_fileName, final int p_run, final String p_config, final CChairAgent p_chair, final Integer p_iteration )
    {
        final String l_currentGroup = "group " + p_chair.getGroupID();

        try ( final hdf5.H5File l_file = new hdf5.H5File( p_fileName, hdf5.H5F_ACC_RDWR ); )
        {
            final hdf5.Group l_group;

            l_group = l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( p_config )
                                       .asCommonFG().openGroup( l_currentGroup ).asCommonFG().openGroup( "lastIt" );

            final hdf5.DataSet l_dataSet = new hdf5.DataSet(
                l_group.asCommonFG().openDataSet( "lastIt" )
            );

            final int[] l_buf = new int[1];

            l_buf[0] = p_iteration;

            l_dataSet.write( new IntPointer( l_buf ), new hdf5.DataType( hdf5.PredType.NATIVE_INT() ) );

        }
        catch ( final Exception l_ex )
        {
            l_ex.printStackTrace();
        }

        return this;
    }

    /**
     * write number of last iteration
     * @param p_fileName name of h5 file
     * @param p_run number of simulation run
     * @param p_config simulation config (grouping and protocol)
     * @param p_chair chair calling the method
     * @param p_iteration number of iteration
     * @return this
     */

    public CDataWriter writeLastIteration( final String p_fileName, final int p_run, final String p_config, final CChairAgent p_chair, final Integer p_iteration )
    {
        final String l_currentGroup = "group " + p_chair.getGroupID();

        final hdf5.H5File l_file = new hdf5.H5File();
        l_file.openFile( p_fileName, hdf5.H5F_ACC_RDWR );

        try
        {
            final hdf5.Group l_group;

            l_group = l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( p_config )
                                       .asCommonFG().openGroup( l_currentGroup ).asCommonFG().openGroup( "lastIt" );

            final hdf5.DataSet l_dataSet = new hdf5.DataSet(
                l_group.asCommonFG().openDataSet( "lastIt" )
            );

            final int[] l_buf = new int[1];

            l_buf[0] = p_iteration;

            l_dataSet.write( new IntPointer( l_buf ), new hdf5.DataType( hdf5.PredType.NATIVE_INT() ) );

        }
        catch ( final Exception l_ex )
        {
            l_ex.printStackTrace();
        }
        finally
        {
            l_file.close();
        }
        return this;
    }

Try With Resources try(final hdf5.H5File l_file=new hdf5.H5File(p_fileName,hdf5.H5F_ACC_RDWR)) in method public writeLastIteration(p_fileName String, p_run int, p_config String, p_chair CChairAgent, p_iteration Integer) : CDataWriter from class org.lightvoting.simulation.statistics.CDataWriter


    /**
     * write default number of last iteration (-1)
     * @param p_fileName name of h5 file
     * @param p_run number of simulation run
     * @param p_config simulation config (grouping and protocol)
     * @param p_groupNum group number
     * @return this
     */

    public CDataWriter writeDefaultLastIteration( final String p_fileName, final int p_run, final String p_config, final int p_groupNum )
    {
        final String l_currentGroup = "group " + p_groupNum;

        try ( final hdf5.H5File l_file = new hdf5.H5File( p_fileName, hdf5.H5F_ACC_RDWR ); )
        {
            final hdf5.Group l_group;

            l_group = l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( p_config )
                            .asCommonFG().openGroup( l_currentGroup ).asCommonFG().createGroup( "lastIt" );

            final hdf5.DataSet l_dataSet = new hdf5.DataSet(
                l_group.asCommonFG().createDataSet( "lastIt", new hdf5.DataType( hdf5.PredType.NATIVE_INT() ),
                                                    new hdf5.DataSpace( 2, new long[]{1, 1} ), new hdf5.DSetCreatPropList()
                )
            );

            final int[] l_buf = new int[1];

            l_buf[0] = -1;

            l_dataSet.write( new IntPointer( l_buf ), new hdf5.DataType( hdf5.PredType.NATIVE_INT() ) );

        }
        catch ( final Exception l_ex )
        {
            l_ex.printStackTrace();
        }

        return this;

    }

    /**
     * write default number of last iteration (-1)
     * @param p_fileName name of h5 file
     * @param p_run number of simulation run
     * @param p_config simulation config (grouping and protocol)
     * @param p_groupNum group number
     * @return this
     */

    public CDataWriter writeDefaultLastIteration( final String p_fileName, final int p_run, final String p_config, final int p_groupNum )
    {
        final String l_currentGroup = "group " + p_groupNum;

        final hdf5.H5File l_file = new hdf5.H5File();
        l_file.openFile( p_fileName, hdf5.H5F_ACC_RDWR );

        try
        {
            final hdf5.Group l_group;

            l_group = l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( p_config )
                            .asCommonFG().openGroup( l_currentGroup ).asCommonFG().createGroup( "lastIt" );

            final hdf5.DataSet l_dataSet = new hdf5.DataSet(
                l_group.asCommonFG().createDataSet( "lastIt", new hdf5.DataType( hdf5.PredType.NATIVE_INT() ),
                                                    new hdf5.DataSpace( 2, new long[]{1, 1} ), new hdf5.DSetCreatPropList()
                )
            );

            final int[] l_buf = new int[1];

            l_buf[0] = -1;

            l_dataSet.write( new IntPointer( l_buf ), new hdf5.DataType( hdf5.PredType.NATIVE_INT() ) );

        }
        catch ( final Exception l_ex )
        {
            l_ex.printStackTrace();
        }
        finally
        {
            l_file.close();
        }

        return this;

    }

Try With Resources try(final hdf5.H5File l_file=new hdf5.H5File(p_fileName,hdf5.H5F_ACC_RDWR)) in method public writeDefaultLastIteration(p_fileName String, p_run int, p_config String, p_groupNum int) : CDataWriter from class org.lightvoting.simulation.statistics.CDataWriter


    /**
     * write (intermediate) election results for coordinated grouping to h5 file
     * @param p_fileName name of h5 file
     * @param p_run run number
     * @param p_conf configuration
     * @param p_chairAgent chair agent
     * @param p_comResultBV election result
     * @param p_coorNum number of (intermediate) election
     * @return this
     */
    public CDataWriter writeCommitteeCoordinated( final String p_fileName, final int p_run, final String p_conf, final CChairAgent p_chairAgent,
                                           final BitVector p_comResultBV,
                                           final int p_coorNum
    )
    {
        final String l_currentGroup = "group " + p_chairAgent.getGroupID();

        try ( final hdf5.H5File l_file = new hdf5.H5File( p_fileName, hdf5.H5F_ACC_RDWR ); )
        {
            final hdf5.Group l_group;

            final hdf5.PredType l_predType = hdf5.PredType.C_S1();
            l_predType.setSize( 256 );

            l_group = l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( p_conf )
                            .asCommonFG().openGroup( l_currentGroup ).asCommonFG().createGroup( "im_" + p_coorNum );

            final hdf5.DataSet l_dataSet = l_group.asCommonFG().createDataSet( "committee", l_predType,
                                                                            new hdf5.DataSpace( 1, new long[]{1} ) );

            final int[] l_buf = new int[1];

            l_dataSet.write( new BytePointer( p_comResultBV.toString() ), new hdf5.DataType( hdf5.PredType.C_S1() ) );

        }
        catch ( final Exception l_ex )
        {
            l_ex.printStackTrace();
        }

        return this;

    }

    /**
     * write (intermediate) election results for coordinated grouping to h5 file
     * @param p_fileName name of h5 file
     * @param p_run run number
     * @param p_conf configuration
     * @param p_chairAgent chair agent
     * @param p_comResultBV election result
     * @param p_coorNum number of (intermediate) election
     * @return this
     */
    public CDataWriter writeCommitteeCoordinated( final String p_fileName, final int p_run, final String p_conf, final CChairAgent p_chairAgent,
                                           final BitVector p_comResultBV,
                                           final int p_coorNum
    )
    {
        final String l_currentGroup = "group " + p_chairAgent.getGroupID();

        final hdf5.H5File l_file = new hdf5.H5File();
        l_file.openFile( p_fileName, hdf5.H5F_ACC_RDWR );

        try
        {
            final hdf5.Group l_group;

            final hdf5.PredType l_predType = hdf5.PredType.C_S1();
            l_predType.setSize( 256 );

            l_group = l_file.asCommonFG().openGroup( String.valueOf( p_run ) ).asCommonFG().openGroup( p_conf )
                            .asCommonFG().openGroup( l_currentGroup ).asCommonFG().createGroup( "im_" + p_coorNum );

            final hdf5.DataSet l_dataSet = l_group.asCommonFG().createDataSet( "committee", l_predType,
                                                                            new hdf5.DataSpace( 1, new long[]{1} ) );

            final int[] l_buf = new int[1];

            l_dataSet.write( new BytePointer( p_comResultBV.toString() ), new hdf5.DataType( hdf5.PredType.C_S1() ) );

        }
        catch ( final Exception l_ex )
        {
            l_ex.printStackTrace();
        }
        finally
        {
            l_file.close();
        }
        return this;

    }

Try With Resources try(final hdf5.H5File l_file=new hdf5.H5File(p_fileName,hdf5.H5F_ACC_RDWR)) in method public writeCommitteeCoordinated(p_fileName String, p_run int, p_conf String, p_chairAgent CChairAgent, p_comResultBV BitVector, p_coorNum int) : CDataWriter from class org.lightvoting.simulation.statistics.CDataWriter


    public static void subscribe(Class<? extends EventObject> eventClass, Consumer<EventObject> onNext) {
        subscribe(eventClass, new Flow.Subscriber<>() {
            Flow.Subscription subscription;

            @Override
            public void onSubscribe(Flow.Subscription subscription) {
                this.subscription = subscription;
                this.subscription.request(2);
            }

            @Override
            public void onNext(EventObject item) {
                onNext.accept(item);
                subscription.request(1);
            }

            @Override
            public void onError(Throwable throwable) {
                throwable.printStackTrace();
            }

            @Override
            public void onComplete() {
            }
        });
    }

    public static void subscribe(Class<? extends EventObject> eventClass, Consumer<EventObject> onNext) {
        subscribe(eventClass, new Flow.Subscriber<EventObject>() {
            Flow.Subscription subscription;
            @Override
            public void onSubscribe(Flow.Subscription subscription) {
                this.subscription = subscription;
                this.subscription.request(1);
            }

            @Override
            public void onNext(EventObject item) {
                onNext.accept(item);
                subscription.request(1);
            }

            @Override
            public void onError(Throwable throwable) {
            }

            @Override
            public void onComplete() {
            }
        });
    }

Replace Generic With Diamond Flow.Subscriber<EventObject> with Flow.Subscriber<> in method public subscribe(eventClass Class<? extends EventObject>, onNext Consumer<EventObject>) : void from class frame.event.EventCenter


    static <K, V> XmlMapEntrySet<K, V> with(final XmlMap<K, V> map) {
        return new XmlMapEntrySet<>(map);
    }

    static <K, V> XmlMapEntrySet<K, V> with(final XmlMap<K, V> map) {
        return new XmlMapEntrySet<K, V>(map);
    }

Replace Generic With Diamond XmlMapEntrySet<K,V> with XmlMapEntrySet<> in method package with(map XmlMap<K,V>) : XmlMapEntrySet<K,V> from class walkingkooka.tree.xml.XmlMapEntrySet


    public static Bookmark outlineFromBufferedReader(IBookmarksConverter converter,
            BufferedReader br, String indentation, String pageSeparator,
            String attributesSeparator) throws IOException {

        ArrayList<Bookmark> fathers = new ArrayList<>(8);
        Bookmark newOutline = new Bookmark();

        fathers.add(newOutline);

        String line;
        int fatherIndex = 0;
        int newFatherIndex = 1;
        Bookmark current = null;
        Bookmark father = null;
        int numLine = 0;
        while ((line = br.readLine()) != null) {
            numLine++;
            line = Ut.rtrim(line);
            if (line.isEmpty()) {
                continue;
            }
            if (line.lastIndexOf(indentation) <= 0) {
                fatherIndex = line.lastIndexOf(indentation) + 1;
            } else {
                fatherIndex = line.lastIndexOf(indentation) / indentation.length() + 1;
            }
            newFatherIndex = fatherIndex + 1;
            current = bookmarkFromString(current, converter, line, indentation, pageSeparator,
                    attributesSeparator);
            if (fatherIndex >= fathers.size()) {
                father = fathers.get(fathers.size() - 1);
            } else {
                father = fathers.get(fatherIndex);
            }
            father.add(current);

            if (newFatherIndex < fathers.size()) {
                fathers.remove(newFatherIndex);
                fathers.add(newFatherIndex, current);
            } else {
                fathers.add(current);
            }
        }
        br.close();
        return newOutline;

    }

    public static Bookmark outlineFromBufferedReader(IBookmarksConverter converter,
            BufferedReader br, String indentation, String pageSeparator,
            String attributesSeparator) throws IOException {

        ArrayList<Bookmark> fathers = new ArrayList<Bookmark>(8);
        Bookmark newOutline = new Bookmark();

        fathers.add(newOutline);

        String line;
        int fatherIndex = 0;
        int newFatherIndex = 1;
        Bookmark current = null;
        Bookmark father = null;
        int numLine = 0;
        while ((line = br.readLine()) != null) {
            numLine++;
            line = Ut.rtrim(line);
            if (line.isEmpty()) {
                continue;
            }
            if (line.lastIndexOf(indentation) <= 0) {
                fatherIndex = line.lastIndexOf(indentation) + 1;
            } else {
                fatherIndex = line.lastIndexOf(indentation) / indentation.length() + 1;
            }
            newFatherIndex = fatherIndex + 1;
            current = bookmarkFromString(current, converter, line, indentation, pageSeparator,
                    attributesSeparator);
            if (fatherIndex >= fathers.size()) {
                father = fathers.get(fathers.size() - 1);
            } else {
                father = fathers.get(fatherIndex);
            }
            father.add(current);

            if (newFatherIndex < fathers.size()) {
                fathers.remove(newFatherIndex);
                fathers.add(newFatherIndex, current);
            } else {
                fathers.add(current);
            }
        }
        br.close();
        return newOutline;

    }

Replace Generic With Diamond ArrayList<Bookmark> with ArrayList<> in method public outlineFromBufferedReader(converter IBookmarksConverter, br BufferedReader, indentation String, pageSeparator String, attributesSeparator String) : Bookmark from class it.flavianopetrocchi.jpdfbookmarks.bookmark.Bookmark


    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(() -> {
            AboutBox dialog = new AboutBox(new javax.swing.JFrame(), true);
            dialog.addWindowListener(new java.awt.event.WindowAdapter() {

                @Override
                public void windowClosing(java.awt.event.WindowEvent e) {
                    System.exit(0);
                }
            });
            dialog.setVisible(true);
        });
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                AboutBox dialog = new AboutBox(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {

                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

Replace Anonymous With Lambda it.flavianopetrocchi.jpdfbookmarks.AboutBox.main.invokeLater.new Runnable with () -> {AboutBox dialog=new AboutBox(new javax.swing.JFrame(),true); in method public main(args String[]) : void from class it.flavianopetrocchi.jpdfbookmarks.AboutBox


    private ArrayList<Bookmark> backupBookmarks(ArrayList<Bookmark> bookmarks) {
        ArrayList<Bookmark> backup = new ArrayList<>(bookmarks.size());

        for (Bookmark b : bookmarks) {
            Bookmark copy = Bookmark.cloneBookmark(b, false);
            backup.add(copy);
        }
        return backup;
    }

    private ArrayList<Bookmark> backupBookmarks(ArrayList<Bookmark> bookmarks) {

        ArrayList<Bookmark> backup = new ArrayList<Bookmark>(bookmarks.size());
        for (Bookmark b : bookmarks) {
            Bookmark copy = Bookmark.cloneBookmark(b, false);
            backup.add(copy);
        }
        return backup;
    }

Replace Generic With Diamond ArrayList<Bookmark> with ArrayList<> in method private backupBookmarks(bookmarks ArrayList<Bookmark>) : ArrayList<Bookmark> from class it.flavianopetrocchi.jpdfbookmarks.UndoableBookmarksAction


    public UndoableDeleteBookmark(DefaultTreeModel model,
            ArrayList<Bookmark> bookmarks) {
        this.treeModel = model;
        for (Bookmark bookmark : bookmarks) {
            Bookmark parent = (Bookmark) bookmark.getParent();
            int i = parent.getIndex(bookmark);
            ArrayList<Bookmark> list = null;
            if (parentsMap.containsKey(parent)) {
                list = parentsMap.get(parent);
            } else {
                list = new ArrayList<>();
                parentsMap.put(parent, list);
            }
            if (i >= list.size()) {
                for (int j = list.size(); j < i; j++) {
                    list.add(j, null);
                }
                list.add(i, bookmark);
            } else {
                list.set(i, bookmark);
            }
        }
    }

    public UndoableDeleteBookmark(DefaultTreeModel model,
            ArrayList<Bookmark> bookmarks) {
        this.treeModel = model;
        for (Bookmark bookmark : bookmarks) {
            Bookmark parent = (Bookmark) bookmark.getParent();
            int i = parent.getIndex(bookmark);
            ArrayList<Bookmark> list = null;
            if (parentsMap.containsKey(parent)) {
                list = parentsMap.get(parent);
            } else {
                list = new ArrayList<Bookmark>();
                parentsMap.put(parent, list);
            }
            if (i >= list.size()) {
                for (int j = list.size(); j < i; j++) {
                    list.add(j, null);
                }
                list.add(i, bookmark);
            } else {
                list.set(i, bookmark);
            }
        }
    }

Replace Generic With Diamond ArrayList<Bookmark> with ArrayList<> in method public UndoableDeleteBookmark(model DefaultTreeModel, bookmarks ArrayList<Bookmark>) from class it.flavianopetrocchi.jpdfbookmarks.UndoableDeleteBookmark


            @Override
            protected void done() {
                Bookmark root;
                try {
                    root = get();
                    bookmarksTree.setRootVisible(false);
                    bookmarksTree.setEditable(true);
                    if (root != null) {
                        bookmarksTreeModel.setRoot(root);
                        recreateNodesOpenedState();
                    } else {
                        bookmarksTreeModel.setRoot(new Bookmark());
                    }
                    bookmarksTree.treeDidChange();
                    SwingUtilities.invokeLater(() -> {
                        if (target != null) {
                            followBookmarkInView(target);
                        } else {
                            viewPanel.goToFirstPage();
                        }
                    });
                    updateThumbnailsPanel(fileOperator.getViewPanel().getThumbnails());
                } catch (InterruptedException | ExecutionException ex) {
                    showErrorMessage(Res.getString("ERROR_OPENING_FILE") + " "
                            + file.getName());
                } finally {
                    CursorToolkit.stopWaitCursor(tbBold);
                    removeProgressBar();
                }
            }

            @Override
            protected void done() {
                Bookmark root = null;
                try {
                    root = get();
                    bookmarksTree.setRootVisible(false);
                    bookmarksTree.setEditable(true);
                    if (root != null) {
                        bookmarksTreeModel.setRoot(root);
                        recreateNodesOpenedState();
                    } else {
                        bookmarksTreeModel.setRoot(new Bookmark());
                    }
                    bookmarksTree.treeDidChange();
                    SwingUtilities.invokeLater(new Runnable() {

                        @Override
                        public void run() {
                            if (target != null) {
                                followBookmarkInView(target);
                            } else {
                                viewPanel.goToFirstPage();
                            }
                        }
                    });
                    updateThumbnailsPanel(fileOperator.getViewPanel().getThumbnails());
                } catch (Exception ex) {
                    showErrorMessage(Res.getString("ERROR_OPENING_FILE") + " "
                            + file.getName());
                } finally {
                    CursorToolkit.stopWaitCursor(tbBold);
                    removeProgressBar();
                }
            }

Replace Anonymous With Lambda it.flavianopetrocchi.jpdfbookmarks.JPdfBookmarksGui.openFileAsync.opener.new SwingWorker<Bookmark,Void>.done.invokeLater.new Runnable with () -> {if(target != null){followBookmarkInView(target); in method protected done() : void from class it.flavianopetrocchi.jpdfbookmarks.JPdfBookmarksGui.openFileAsync.opener.new SwingWorker<Bookmark,Void>


    private void copyBookmarkFromView() {
        Bookmark b = viewPanel.getBookmarkFromView();
        if (b != null) {
            //Bookmark bookmarkCopied = Bookmark.cloneBookmark(b, !b.isOpened());
            ArrayList<Bookmark> bookmarks = new ArrayList<>();
            bookmarks.add(b);
            BookmarkSelection bs = new BookmarkSelection(bookmarks, bookmarksFlavor, false, fileOperator.getFile());
            localClipboard.setContents(bs, bs);
            flavorsChanged();
        }
    }

    private void copyBookmarkFromView() {
        Bookmark b = viewPanel.getBookmarkFromView();
        if (b != null) {
            //Bookmark bookmarkCopied = Bookmark.cloneBookmark(b, !b.isOpened());
            ArrayList<Bookmark> bookmarks = new ArrayList<Bookmark>();
            bookmarks.add(b);
            BookmarkSelection bs = new BookmarkSelection(bookmarks, bookmarksFlavor, false, fileOperator.getFile());
            localClipboard.setContents(bs, bs);
            flavorsChanged();
        }
    }

Replace Generic With Diamond ArrayList<Bookmark> with ArrayList<> in method private copyBookmarkFromView() : void from class it.flavianopetrocchi.jpdfbookmarks.JPdfBookmarksGui


    private void paste() {
        Transferable content = localClipboard.getContents(this);

        if (content != null && content.isDataFlavorSupported(bookmarksFlavor)) {
            try {
                BookmarkSelection bs = (BookmarkSelection) content.getTransferData(bookmarksFlavor);
                ArrayList<Bookmark> bookmarksCopied = bs.getBookmarks();
                if (!fileOperator.getFile().equals(bs.getFile())) {
                    File relativeRemoteFile = Ut.createRelativePath(fileOperator.getFile(), bs.getFile());
                    for (Bookmark b : bookmarksCopied) {
                        b.setRemoteFilePathWithChildren(relativeRemoteFile);
                    }
                }
                TreePath path = bookmarksTree.getSelectionPath();
                Bookmark father;
                if (path != null) {
                    Bookmark selected = (Bookmark) path.getLastPathComponent();
                    father = (Bookmark) selected.getParent();
                    int i = father.getIndex(selected);
                    for (Bookmark b : bookmarksCopied) {
                        father.insert(b, i + 1);
                        i++;
                    }
                } else {
                    father = (Bookmark) bookmarksTreeModel.getRoot();
                    for (Bookmark b : bookmarksCopied) {
                        father.add(b);
                    }
                }
                UndoablePasteBookmarks undoablePaste = new UndoablePasteBookmarks(bookmarksTreeModel, bookmarksCopied);
                undoablePaste.doEdit();
                undoSupport.postEdit(undoablePaste);
                fileOperator.setFileChanged(true);
                bookmarksTreeModel.nodeStructureChanged(father);
                recreateNodesOpenedState();
            } catch (UnsupportedFlavorException | IOException ex) {
            }
        }
    }

    private void paste() {
        Transferable content = localClipboard.getContents(this);

        if (content != null && content.isDataFlavorSupported(bookmarksFlavor)) {
            try {
                BookmarkSelection bs = (BookmarkSelection) content.getTransferData(bookmarksFlavor);
                ArrayList<Bookmark> bookmarksCopied = bs.getBookmarks();
                if (!fileOperator.getFile().equals(bs.getFile())) {
                    File relativeRemoteFile = Ut.createRelativePath(fileOperator.getFile(), bs.getFile());
                    for (Bookmark b : bookmarksCopied) {
                        b.setRemoteFilePathWithChildren(relativeRemoteFile);
                    }
                }
                TreePath path = bookmarksTree.getSelectionPath();
                Bookmark father;
                if (path != null) {
                    Bookmark selected = (Bookmark) path.getLastPathComponent();
                    father = (Bookmark) selected.getParent();
                    int i = father.getIndex(selected);
                    for (Bookmark b : bookmarksCopied) {
                        father.insert(b, i + 1);
                        i++;
                    }
                } else {
                    father = (Bookmark) bookmarksTreeModel.getRoot();
                    for (Bookmark b : bookmarksCopied) {
                        father.add(b);
                    }
                }
                UndoablePasteBookmarks undoablePaste = new UndoablePasteBookmarks(bookmarksTreeModel, bookmarksCopied);
                undoablePaste.doEdit();
                undoSupport.postEdit(undoablePaste);
                fileOperator.setFileChanged(true);
                bookmarksTreeModel.nodeStructureChanged(father);
                recreateNodesOpenedState();
            } catch (UnsupportedFlavorException ex) {
            } catch (IOException ex) {
            }
        }
    }

Merge Catch [catch(UnsupportedFlavorException ex), catch(IOException ex)] to catch(UnsupportedFlavorException|IOException ex) in method private paste() : void from class it.flavianopetrocchi.jpdfbookmarks.JPdfBookmarksGui


    private ArrayList<Bookmark> getSelectedBookmarks() {

        ArrayList<Bookmark> bookmarksList = new ArrayList<>();
        TreePath[] paths = bookmarksTree.getSelectionPaths();
        for (TreePath path : paths) {
            bookmarksList.add((Bookmark) path.getLastPathComponent());
        }
        return bookmarksList;
    }

    private ArrayList<Bookmark> getSelectedBookmarks() {

        ArrayList<Bookmark> bookmarksList = new ArrayList<Bookmark>();
        TreePath[] paths = bookmarksTree.getSelectionPaths();
        for (TreePath path : paths) {
            bookmarksList.add((Bookmark) path.getLastPathComponent());
        }
        return bookmarksList;
    }

Replace Generic With Diamond ArrayList<Bookmark> with ArrayList<> in method private getSelectedBookmarks() : ArrayList<Bookmark> from class it.flavianopetrocchi.jpdfbookmarks.JPdfBookmarksGui