    /**
     * @return Response with the id of the imported bulk upload
     */
    @POST
    @Path("{id}/file")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    @Produces(MediaType.APPLICATION_JSON)
    public Response post(@PathParam("id") long uploadId,
                         @FormDataParam("file") InputStream inputStream,
                         @FormDataParam("type") String type,
                         @FormDataParam("file") FormDataContentDisposition contentDispositionHeader) {
        String userId = getUserId();
        EntryType addType = EntryType.valueOf(type.toUpperCase());

        // determine upload format
        String fileName = contentDispositionHeader.getFileName();
        String extension = fileName.substring(fileName.lastIndexOf(".") + 1);
        FileUploadFormat format = FileUploadFormat.fromString(extension);

        try (FileBulkUpload upload = new FileBulkUpload(userId, inputStream, uploadId, addType, format)) { // todo
            ProcessedBulkUpload processedBulkUpload = upload.process();
            if (processedBulkUpload.isSuccess())
                return Response.status(Response.Status.OK).entity(processedBulkUpload).build();
            return Response.status(Response.Status.BAD_REQUEST).entity(processedBulkUpload).build();
        } catch (Exception e) {
            Logger.error(e);
            ProcessedBulkUpload processedBulkUpload = new ProcessedBulkUpload();
            processedBulkUpload.setUserMessage(e.getCause().getMessage());
            processedBulkUpload.setSuccess(false);
            return Response.status(Response.Status.BAD_REQUEST).entity(processedBulkUpload).build();
        }
    }

    /**
     * @return Response with the id of the imported bulk upload
     */
    @POST
    @Path("file")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    @Produces(MediaType.APPLICATION_JSON)
    public Response post(@FormDataParam("file") InputStream fileInputStream,
                         @FormDataParam("type") String type,
                         @FormDataParam("file") FormDataContentDisposition contentDispositionHeader) {
        try {
            String userId = getUserId();
            String fileName = userId + "-" + System.currentTimeMillis() + "-" +
                    contentDispositionHeader.getFileName();
            File file = Paths.get(Utils.getConfigValue(ConfigurationKey.DATA_DIRECTORY),
                    "bulk-import", fileName).toFile();
            FileUtils.copyInputStreamToFile(fileInputStream, file);

            EntryType addType = EntryType.valueOf(type.toUpperCase());
            FileBulkUpload bulkUpload = new FileBulkUpload(userId, file.toPath(), addType);
            ProcessedBulkUpload processedBulkUpload = bulkUpload.process();
            if (processedBulkUpload.isSuccess())
                return Response.status(Response.Status.OK).entity(processedBulkUpload).build();
            return Response.status(Response.Status.BAD_REQUEST).entity(processedBulkUpload).build();
        } catch (Exception e) {
            Logger.error(e);
            ProcessedBulkUpload processedBulkUpload = new ProcessedBulkUpload();
            processedBulkUpload.setUserMessage(e.getCause().getMessage());
            processedBulkUpload.setSuccess(false);
            return Response.status(Response.Status.BAD_REQUEST).entity(processedBulkUpload).build();
        }
    }

Try With Resources try(FileBulkUpload upload=new FileBulkUpload(userId,inputStream,uploadId,addType,format)) in method public post(uploadId long, inputStream InputStream, type String, contentDispositionHeader FormDataContentDisposition) : Response from class org.jbei.ice.services.rest.BulkUploadResource


    @Override
    public FeaturedDNASequence parse(String textSequence) throws InvalidFormatParserException {
        try {
            textSequence = cleanSequence(textSequence);
            try (BufferedReader br = new BufferedReader(new StringReader(textSequence))) {
                FeaturedDNASequence sequence;
                RichSequenceIterator richSequences = IOTools.readFastaDNA(br, null);

                if (richSequences.hasNext()) {
                    RichSequence richSequence = richSequences.nextRichSequence();
                    sequence = new FeaturedDNASequence(richSequence.seqString(), new LinkedList<>());
                } else {
                    throw new InvalidFormatParserException("No sequence found in sequence file!");
                }
                return sequence;
            }
        } catch (BioException | IOException e) {
            throw new InvalidFormatParserException("Couldn't parse FASTA sequence!", e);
        }
    }

    @Override
    public FeaturedDNASequence parse(String textSequence) throws InvalidFormatParserException {
        textSequence = cleanSequence(textSequence);

        BufferedReader br = new BufferedReader(new StringReader(textSequence));
        FeaturedDNASequence sequence;

        try {
            RichSequenceIterator richSequences = IOTools.readFastaDNA(br, null);

            if (richSequences.hasNext()) {
                RichSequence richSequence = richSequences.nextRichSequence();
                sequence = new FeaturedDNASequence(richSequence.seqString(), new LinkedList<>());
            } else {
                throw new InvalidFormatParserException("No sequence found in sequence file!");
            }
        } catch (BioException e) {
            throw new InvalidFormatParserException("Couldn't parse FASTA sequence!", e);
        }

        return sequence;
    }

Try With Resources try(BufferedReader br=new BufferedReader(new StringReader(textSequence))) in method public parse(textSequence String) : FeaturedDNASequence from class org.jbei.ice.lib.parsers.fasta.FastaParser


    /**
     * Process the zip file. It expects that there is exactly one file with the .csv extension.
     * This means that a .csv cannot be used as an attachment
     * </p>
     * Also, all dot files are ignored
     */
    public ProcessedBulkUpload processUpload() {
        ProcessedBulkUpload processedBulkUpload = new ProcessedBulkUpload();
        String csvFile = null;
        HashMap<String, InputStream> files = new HashMap<>();

        try (ZipFile zipFile = new ZipFile(zipFilePath.toFile())) {
            Enumeration<? extends ZipEntry> enumeration = zipFile.entries();

            // go through zip elements
            while (enumeration.hasMoreElements()) {
                ZipEntry zipEntry = enumeration.nextElement();
                // does not go into directories for now
                if (zipEntry.isDirectory())
                    continue;

                String name = zipEntry.getName();
                if (name.contains("/"))
                    name = name.substring(name.lastIndexOf("/") + 1);

                // ignore all dot files
                if (name.startsWith("."))
                    continue;

                // get main csv
                if (name.endsWith(".csv")) {
                    if (csvFile != null) {
                        processedBulkUpload.setSuccess(false);
                        processedBulkUpload.setUserMessage("Duplicate csv file in zip archive. It should only contain one.");
                        return processedBulkUpload;
                    }
                    csvFile = Utils.getString(zipFile.getInputStream(zipEntry));
                } else {
                    InputStream inputStream = zipFile.getInputStream(zipEntry);
                    files.put(name, inputStream);
                }
            }
        } catch (IOException e) {
            processedBulkUpload.setSuccess(false);
            processedBulkUpload.setUserMessage(e.getCause().getMessage());
            return processedBulkUpload;
        }

        if (csvFile == null) {
            processedBulkUpload.setSuccess(false);
            processedBulkUpload.setUserMessage("Could not find a csv file in the zip archive");
            return processedBulkUpload;
        }

        try (ByteArrayInputStream inputStream = new ByteArrayInputStream(csvFile.getBytes())) {

            // retrieve the partData and validates
            List<PartWithSample> updates = super.getBulkUploadDataFromFile(inputStream);
            if (updates == null) {
                processedBulkUpload.setSuccess(false);
                processedBulkUpload.setUserMessage("Validation failed");
                for (EntryField field : invalidFields) {
                    processedBulkUpload.getHeaders().add(new EntryHeaderValue(false, field));
                }
                return processedBulkUpload;
            }

            // validate files to ensure that for each partData with a file, that the file is available
            for (PartWithSample partWithSample : updates) {

                // check sequences
                PartData data = partWithSample.getPartData();
                String sequenceFile = data.getSequenceFileName();
                if (StringUtils.isNotBlank(sequenceFile) && files.get(sequenceFile) == null) {
                    processedBulkUpload.setSuccess(false);
                    processedBulkUpload.setUserMessage("Sequence file \"" + sequenceFile
                            + "\" not found in the zip archive");
                    return processedBulkUpload;
                }

                // check attachments
                String attachmentFile;
                if (data.getAttachments() != null && !data.getAttachments().isEmpty()) {
                    attachmentFile = data.getAttachments().get(0).getFilename();
                    if (StringUtils.isNotBlank(attachmentFile) && files.get(attachmentFile) == null) {
                        processedBulkUpload.setSuccess(false);
                        processedBulkUpload.setUserMessage("Attachment file \"" + sequenceFile
                                + "\" not found in the zip archive");
                        return processedBulkUpload;
                    }
                }

                // todo : trace sequences
            }

            // create actual registry parts
            BulkEntryCreator creator = new BulkEntryCreator();
            long uploadId = creator.createBulkUpload(userId, addType);

            // create entries
            if (!creator.createEntries(userId, uploadId, updates, files)) {
                String errorMsg = "Error creating entries for upload";
                throw new IOException(errorMsg);
                //todo: delete upload id
            }

            processedBulkUpload.setUploadId(uploadId);
            return processedBulkUpload;
        } catch (IOException e) {
            Logger.error(e);
            processedBulkUpload.setSuccess(false);
            processedBulkUpload.setUserMessage(e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
            return processedBulkUpload;
        }
    }

    /**
     * Process the zip file. It expects that there is exactly one file with the .csv extension.
     * This means that a .csv cannot be used as an attachment
     * </p>
     * Also, all dot files are ignored
     */
    public ProcessedBulkUpload processUpload() {
        ProcessedBulkUpload processedBulkUpload = new ProcessedBulkUpload();
        String csvFile = null;
        HashMap<String, InputStream> files = new HashMap<>();

        try {
            ZipFile zipFile = new ZipFile(zipFilePath.toFile());
            Enumeration<? extends ZipEntry> enumeration = zipFile.entries();

            // go through zip elements
            while (enumeration.hasMoreElements()) {
                ZipEntry zipEntry = enumeration.nextElement();
                // does not go into directories for now
                if (zipEntry.isDirectory())
                    continue;

                String name = zipEntry.getName();
                if (name.contains("/"))
                    name = name.substring(name.lastIndexOf("/") + 1);

                // ignore all dot files
                if (name.startsWith("."))
                    continue;

                // get main csv
                if (name.endsWith(".csv")) {
                    if (csvFile != null) {
                        processedBulkUpload.setSuccess(false);
                        processedBulkUpload.setUserMessage("Duplicate csv file in zip archive. It should only contain one.");
                        return processedBulkUpload;
                    }
                    csvFile = Utils.getString(zipFile.getInputStream(zipEntry));
                } else {
                    InputStream inputStream = zipFile.getInputStream(zipEntry);
                    files.put(name, inputStream);
                }
            }
        } catch (IOException e) {
            processedBulkUpload.setSuccess(false);
            processedBulkUpload.setUserMessage(e.getCause().getMessage());
            return processedBulkUpload;
        }

        if (csvFile == null) {
            processedBulkUpload.setSuccess(false);
            processedBulkUpload.setUserMessage("Could not find a csv file in the zip archive");
            return processedBulkUpload;
        }

        try (ByteArrayInputStream inputStream = new ByteArrayInputStream(csvFile.getBytes())) {

            // retrieve the partData and validates
            List<PartWithSample> updates = super.getBulkUploadDataFromFile(inputStream);
            if (updates == null) {
                processedBulkUpload.setSuccess(false);
                processedBulkUpload.setUserMessage("Validation failed");
                for (EntryField field : invalidFields) {
                    processedBulkUpload.getHeaders().add(new EntryHeaderValue(false, field));
                }
                return processedBulkUpload;
            }

            // validate files to ensure that for each partData with a file, that the file is available
            for (PartWithSample partWithSample : updates) {

                // check sequences
                PartData data = partWithSample.getPartData();
                String sequenceFile = data.getSequenceFileName();
                if (StringUtils.isNotBlank(sequenceFile) && files.get(sequenceFile) == null) {
                    processedBulkUpload.setSuccess(false);
                    processedBulkUpload.setUserMessage("Sequence file \"" + sequenceFile
                            + "\" not found in the zip archive");
                    return processedBulkUpload;
                }

                // check attachments
                String attachmentFile;
                if (data.getAttachments() != null && !data.getAttachments().isEmpty()) {
                    attachmentFile = data.getAttachments().get(0).getFilename();
                    if (StringUtils.isNotBlank(attachmentFile) && files.get(attachmentFile) == null) {
                        processedBulkUpload.setSuccess(false);
                        processedBulkUpload.setUserMessage("Attachment file \"" + sequenceFile
                                + "\" not found in the zip archive");
                        return processedBulkUpload;
                    }
                }

                // todo : trace sequences
            }

            // create actual registry parts
            BulkEntryCreator creator = new BulkEntryCreator();
            long uploadId = creator.createBulkUpload(userId, addType);

            // create entries
            if (!creator.createEntries(userId, uploadId, updates, files)) {
                String errorMsg = "Error creating entries for upload";
                throw new IOException(errorMsg);
                //todo: delete upload id
            }

            processedBulkUpload.setUploadId(uploadId);
            return processedBulkUpload;
        } catch (IOException e) {
            Logger.error(e);
            processedBulkUpload.setSuccess(false);
            processedBulkUpload.setUserMessage(e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
            return processedBulkUpload;
        }
    }

Try With Resources try(ZipFile zipFile=new ZipFile(zipFilePath.toFile())) in method public processUpload() : ProcessedBulkUpload from class org.jbei.ice.lib.bulkupload.BulkZipUpload


    @GET
    @Path("upload/{type}")
    public Response getUploadCSV(@PathParam("type") final String type,
                                 @QueryParam("link") final String linkedType) {
        EntryType entryAddType = EntryType.nameToType(type);
        EntryType linked;
        if (linkedType != null) {
            linked = EntryType.nameToType(linkedType);
        } else {
            linked = null;
        }

        final StreamingOutput stream = output -> {
            byte[] template = FileBulkUpload.getCSVTemplateBytes(entryAddType, linked,
                    "existing".equalsIgnoreCase(linkedType));
            ByteArrayInputStream input = new ByteArrayInputStream(template);
            ByteStreams.copy(input, output);
        };

        String filename = type.toLowerCase();
        if (linkedType != null) {
            filename += ("_" + linkedType.toLowerCase());
        }

        return addHeaders(Response.ok(stream), filename + "_csv_upload.csv");
    }

    @GET
    @Path("upload/{type}")
    public Response getUploadCSV(@PathParam("type") final String type,
                                 @QueryParam("link") final String linkedType) {
        EntryType entryAddType = EntryType.nameToType(type);
        EntryType linked;
        if (linkedType != null) {
            linked = EntryType.nameToType(linkedType);
        } else {
            linked = null;
        }

        final StreamingOutput stream = new StreamingOutput() {
            @Override
            public void write(final OutputStream output) throws IOException, WebApplicationException {
                byte[] template = FileBulkUpload.getCSVTemplateBytes(entryAddType, linked,
                        "existing".equalsIgnoreCase(linkedType));
                ByteArrayInputStream stream = new ByteArrayInputStream(template);
                IOUtils.copy(stream, output);
            }
        };

        String filename = type.toLowerCase();
        if (linkedType != null) {
            filename += ("_" + linkedType.toLowerCase());
        }

        return addHeaders(Response.ok(stream), filename + "_csv_upload.csv");
    }

Replace Anonymous With Lambda org.jbei.ice.services.rest.FileResource.getUploadCSV.stream.new StreamingOutput with output -> {byte[] template=FileBulkUpload.getCSVTemplateBytes(entryAddType,linked,"existing".equalsIgnoreCase(linkedType)); in method public getUploadCSV(type String, linkedType String) : Response from class org.jbei.ice.services.rest.FileResource


    @GET
    @Path("{partId}/sequence/{type}")
    public Response downloadSequence(
            @PathParam("partId") final long partId,
            @PathParam("type") final String downloadType,
            @DefaultValue("-1") @QueryParam("remoteId") long remoteId,
            @QueryParam("sid") String sid) {
        if (StringUtils.isEmpty(sessionId))
            sessionId = sid;

        final String userId = getUserId(sessionId);
        final ByteArrayWrapper wrapper;
        if (remoteId != -1) {
            RemoteSequence sequence = new RemoteSequence(remoteId, partId);
            wrapper = sequence.get(downloadType);
        } else {
            wrapper = sequenceController.getSequenceFile(userId, partId, downloadType);
        }

        StreamingOutput stream = output -> {
            final ByteArrayInputStream input = new ByteArrayInputStream(wrapper.getBytes());
            ByteStreams.copy(input, output);
        };

        return addHeaders(Response.ok(stream), wrapper.getName());
    }

    @GET
    @Path("{partId}/sequence/{type}")
    public Response downloadSequence(
            @PathParam("partId") final long partId,
            @PathParam("type") final String downloadType,
            @DefaultValue("-1") @QueryParam("remoteId") long remoteId,
            @QueryParam("sid") String sid) {
        if (StringUtils.isEmpty(sessionId))
            sessionId = sid;

        final String userId = getUserId(sessionId);
        final ByteArrayWrapper wrapper;
        if (remoteId != -1) {
            RemoteSequence sequence = new RemoteSequence(remoteId, partId);
            wrapper = sequence.get(downloadType);
        } else {
            wrapper = sequenceController.getSequenceFile(userId, partId, downloadType);
        }

        StreamingOutput stream = new StreamingOutput() {
            @Override
            public void write(final OutputStream output) throws IOException,
                    WebApplicationException {
                final ByteArrayInputStream stream = new ByteArrayInputStream(wrapper.getBytes());
                IOUtils.copy(stream, output);
            }
        };

        return addHeaders(Response.ok(stream), wrapper.getName());
    }

Replace Anonymous With Lambda org.jbei.ice.services.rest.FileResource.downloadSequence.stream.new StreamingOutput with output -> {final ByteArrayInputStream input=new ByteArrayInputStream(wrapper.getBytes()); in method public downloadSequence(partId long, downloadType String, remoteId long, sid String) : Response from class org.jbei.ice.services.rest.FileResource


    public Setting autoUpdateSetting(String userId, Setting setting) {
        AccountController accountController = new AccountController();
        if (!accountController.isAdministrator(userId))
            throw new PermissionException("Cannot auto update system setting without admin privileges");

        Configuration configuration = dao.get(setting.getKey());
        if (configuration == null) {
            Logger.error("Could not retrieve setting " + setting.getKey());
            return null;
        }

        String osName = System.getProperty("os.name").replaceAll("\\s+", "").toLowerCase();
        String blast = "ncbi-blast-2.6.0+-x64-" + osName + ".tar.gz";

        Path path = Paths.get(dao.get(ConfigurationKey.TEMPORARY_DIRECTORY).getValue(), blast);
        Path dest = Paths.get(dao.get(ConfigurationKey.DATA_DIRECTORY).getValue());
        if (!Files.exists(dest)) {
            Logger.error("Cannot access access dir : " + dest.toString());
            return null;
        }

        try (InputStream is = (new URL(BLAST_FTP_DIR + blast)).openStream()) {
            Files.copy(is, path.toAbsolutePath(), StandardCopyOption.REPLACE_EXISTING);

            Archiver archiver = ArchiverFactory.createArchiver("tar", "gz");
            archiver.extract(path.toFile(), dest.toFile());

            Path valuePath = Paths.get(dest.toString(), "ncbi-blast-2.6.0+", "bin");
            configuration.setValue(valuePath.toString());
            Files.list(valuePath).forEach(dirPath -> {
                try {
                    Files.setPosixFilePermissions(dirPath, PosixFilePermissions.fromString("rwxrwxrwx"));
                } catch (IOException e) {
                    Logger.error(e);
                }
            });

            return dao.update(configuration).toDataTransferObject();
        } catch (Exception e) {
            Logger.error(e);
            return null;
        }
    }

    public Setting autoUpdateSetting(String userId, Setting setting) {
        AccountController accountController = new AccountController();
        if (!accountController.isAdministrator(userId))
            throw new PermissionException("Cannot auto update system setting without admin privileges");

        Configuration configuration = dao.get(setting.getKey());
        if (configuration == null) {
            Logger.error("Could not retrieve setting " + setting.getKey());
            return null;
        }

        String osName = System.getProperty("os.name").replaceAll("\\s+", "").toLowerCase();
        String blast = "ncbi-blast-2.6.0+-x64-" + osName + ".tar.gz";

        Path path = Paths.get(dao.get(ConfigurationKey.TEMPORARY_DIRECTORY).getValue(), blast);
        Path dest = Paths.get(dao.get(ConfigurationKey.DATA_DIRECTORY).getValue());
        if (!Files.exists(dest)) {
            Logger.error("Cannot access access dir : " + dest.toString());
            return null;
        }

        try {
            URL url = new URL("ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.6.0/" + blast);
            try (InputStream is = url.openStream();
                 ByteArrayOutputStream os = new ByteArrayOutputStream()) {

                if (Files.exists(path))
                    Files.delete(path);

                byte[] buf = new byte[4096];
                int n;

                while ((n = is.read(buf)) >= 0) {
                    os.write(buf, 0, n);
                }
                Files.write(path, os.toByteArray());
            }

            Archiver archiver = ArchiverFactory.createArchiver("tar", "gz");
            archiver.extract(path.toFile(), dest.toFile());

            Path valuePath = Paths.get(dest.toString(), "ncbi-blast-2.6.0+", "bin");
            configuration.setValue(valuePath.toString());
            return dao.update(configuration).toDataTransferObject();
        } catch (Exception e) {
            Logger.error(e);
            return null;
        }
    }

Try With Resources try(InputStream is=(new URL(BLAST_FTP_DIR + blast)).openStream()) in method public autoUpdateSetting(userId String, setting Setting) : Setting from class org.jbei.ice.lib.config.ConfigurationController


    @SuppressWarnings("unchecked")
    public ArrayList<Preference> getAccountPreferences(Account account, ArrayList<PreferenceKey> keys)
            throws DAOException {
        Session session = currentSession();
        ArrayList<String> keyString = new ArrayList<>();
        for (PreferenceKey key : keys)
            keyString.add(key.name());

        try {
            Criteria criteria = session.createCriteria(Preference.class)
                                       .add(Restrictions.eq("account", account))
                                       .add(Restrictions.in("key", keyString));
            return new ArrayList<>(criteria.list());
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    @SuppressWarnings("unchecked")
    public ArrayList<Preference> getAccountPreferences(Account account, ArrayList<PreferenceKey> keys)
            throws DAOException {
        Session session = currentSession();
        ArrayList<String> keyString = new ArrayList<>();
        for (PreferenceKey key : keys)
            keyString.add(key.name());

        try {
            Criteria criteria = session.createCriteria(Preference.class)
                                       .add(Restrictions.eq("account", account))
                                       .add(Restrictions.in("key", keyString));
            return new ArrayList<Preference>(criteria.list());
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond ArrayList<Preference> with ArrayList<> in method public getAccountPreferences(account Account, keys ArrayList<PreferenceKey>) : ArrayList<Preference> from class org.jbei.ice.storage.hibernate.dao.PreferencesDAO


    private IceExecutorService() {
        pool = Executors.newFixedThreadPool(5, r -> {
            Thread thread = new Thread(r);
            thread.setPriority(Thread.MIN_PRIORITY);
            return thread;
        });
    }

    private IceExecutorService() {
        pool = Executors.newFixedThreadPool(5, new ThreadFactory() {
            @Override
            public Thread newThread(Runnable r) {
                Thread thread = new Thread(r);
                thread.setPriority(Thread.MIN_PRIORITY);
                return thread;
            }
        });
    }

Replace Anonymous With Lambda org.jbei.ice.lib.executor.IceExecutorService.IceExecutorService.newFixedThreadPool.new ThreadFactory with r -> {Thread thread=new Thread(r); in method private IceExecutorService() from class org.jbei.ice.lib.executor.IceExecutorService


    public static List<DNAFeature> processFeaturesBlastOutput(String blastOutput) {
        List<DNAFeature> hashMap = new ArrayList<>();
        HashSet<String> duplicates = new HashSet<>();

        try (CSVReader reader = new CSVReader(new StringReader(blastOutput))) {
            List<String[]> lines = reader.readAll();

            for (String[] line : lines) {
                String type = line[2];
                String start = line[4];
                String end = line[5];
                if (!duplicates.add(type + ":" + start + ":" + end)) {
                    continue;
                }

                DNAFeature dnaFeature = new DNAFeature();
                dnaFeature.setId(Long.decode(line[0]));
                dnaFeature.setName(line[1]);
                dnaFeature.setType(type);
                dnaFeature.setIdentifier(line[3]);
                DNAFeatureLocation location = new DNAFeatureLocation();
                location.setGenbankStart(Integer.decode(start));
                location.setEnd(Integer.decode(end));
                dnaFeature.getLocations().add(location);
                dnaFeature.setStrand("plus".equalsIgnoreCase(line[8]) ? 1 : -1);
                hashMap.add(dnaFeature);
            }

            return hashMap;
        } catch (IOException e) {
            Logger.error(e);
            return null;
        }
    }

    public static List<DNAFeature> processFeaturesBlastOutput(String blastOutput) {
        List<DNAFeature> hashMap = new ArrayList<>();
        CSVReader reader = new CSVReader(new StringReader(blastOutput));
        HashSet<String> duplicates = new HashSet<>();

        try {
            List<String[]> lines = reader.readAll();
            for (String[] line : lines) {
                String type = line[2];
                String start = line[4];
                String end = line[5];
                if (!duplicates.add(type + ":" + start + ":" + end)) {
//                    Logger.info("duplicate " + line[3]);
                    continue;
                }

                DNAFeature dnaFeature = new DNAFeature();
                dnaFeature.setId(Long.decode(line[0]));
                dnaFeature.setName(line[1]);
                dnaFeature.setType(type);
                dnaFeature.setIdentifier(line[3]);
                DNAFeatureLocation location = new DNAFeatureLocation();
                location.setGenbankStart(Integer.decode(start));
                location.setEnd(Integer.decode(end));
                dnaFeature.getLocations().add(location);
                dnaFeature.setStrand("plus".equalsIgnoreCase(line[8]) ? 1 : -1);
                hashMap.add(dnaFeature);
            }

            return hashMap;
        } catch (IOException e) {
            Logger.error(e);
            return null;
        }
    }

Try With Resources try(CSVReader reader=new CSVReader(new StringReader(blastOutput))) in method public processFeaturesBlastOutput(blastOutput String) : List<DNAFeature> from class org.jbei.ice.lib.search.blast.BlastPlus


    /**
     * Calculate the reverse complement of the given DNA sequence.
     *
     * @param sequence DNA sequence to reverse complement.
     * @return Reversed, complemented sequence.
     * @throws UtilityException
     */
    public static String reverseComplement(String sequence) throws UtilityException {
        SymbolList symL;

        try {
            symL = DNATools.createDNA(sequence);
            symL = DNATools.reverseComplement(symL);
        } catch (IllegalSymbolException | IllegalAlphabetException e) {
            throw new UtilityException(e);
        }

        return symL.seqString();
    }

    /**
     * Calculate the reverse complement of the given DNA sequence.
     *
     * @param sequence DNA sequence to reverse complement.
     * @return Reversed, complemented sequence.
     * @throws UtilityException
     */
    public static String reverseComplement(String sequence) throws UtilityException {
        SymbolList symL = null;

        try {
            symL = DNATools.createDNA(sequence);
            symL = DNATools.reverseComplement(symL);
        } catch (IllegalSymbolException e) {
            throw new UtilityException(e);
        } catch (IllegalAlphabetException e) {
            throw new UtilityException(e);
        }

        return symL.seqString();
    }

Merge Catch [catch(IllegalSymbolException e), catch(IllegalAlphabetException e)] to catch(IllegalSymbolException|IllegalAlphabetException e) in method public reverseComplement(sequence String) : String from class org.jbei.ice.lib.utils.SequenceUtils


    /**
     * Calculate the amino acid translation of the given dnaSequence string.
     *
     * @param dnaSequence DNA sequence to translate.
     * @return String of amino acid symbols.
     * @throws UtilityException
     */
    public static String translateToProtein(String dnaSequence) throws UtilityException {
        SymbolList symL = null;

        try {
            symL = DNATools.createDNA(dnaSequence);
            symL = DNATools.toProtein(symL);
        } catch (IllegalSymbolException | IllegalAlphabetException e) {
            throw new UtilityException(e);
        }

        return symL.seqString();
    }

    /**
     * Calculate the amino acid translation of the given dnaSequence string.
     *
     * @param dnaSequence DNA sequence to translate.
     * @return String of amino acid symbols.
     * @throws UtilityException
     */
    public static String translateToProtein(String dnaSequence) throws UtilityException {
        SymbolList symL = null;

        try {
            symL = DNATools.createDNA(dnaSequence);
            symL = DNATools.toProtein(symL);
        } catch (IllegalSymbolException e) {
            throw new UtilityException(e);
        } catch (IllegalAlphabetException e) {
            throw new UtilityException(e);
        }

        return symL.seqString();
    }

Merge Catch [catch(IllegalSymbolException e), catch(IllegalAlphabetException e)] to catch(IllegalSymbolException|IllegalAlphabetException e) in method public translateToProtein(dnaSequence String) : String from class org.jbei.ice.lib.utils.SequenceUtils


    public HashSet<Group> getByIdList(Set<Long> idsSet) throws DAOException {
        Session session = currentSession();

        try {
            Criteria criteria = session.createCriteria(Group.class).add(Restrictions.in("id", idsSet));
            List list = criteria.list();
            return new HashSet<>(list);

        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    public HashSet<Group> getByIdList(Set<Long> idsSet) throws DAOException {
        Session session = currentSession();

        try {
            Criteria criteria = session.createCriteria(Group.class).add(Restrictions.in("id", idsSet));
            List list = criteria.list();
            return new HashSet<Group>(list);

        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond HashSet<Group> with HashSet<> in method public getByIdList(idsSet Set<Long>) : HashSet<Group> from class org.jbei.ice.storage.hibernate.dao.GroupDAO


    public Set<Group> retrieveMemberGroups(Account account) throws DAOException {
        Criteria criteria = currentSession().createCriteria(Group.class);
        // groups created
        List list = criteria.add(Restrictions.eq("owner", account)).list();
        HashSet<Group> groups = new HashSet<>(list);

        criteria = currentSession().createCriteria(Group.class);
        criteria.createAlias("members", "m");
        criteria.add(Restrictions.eq("m.email", account.getEmail()));
        list = criteria.list();
        if (list != null)
            groups.addAll(list);
        return groups;
    }

    public Set<Group> retrieveMemberGroups(Account account) throws DAOException {
        Criteria criteria = currentSession().createCriteria(Group.class);
        // groups created
        List list = criteria.add(Restrictions.eq("owner", account)).list();
        HashSet<Group> groups = new HashSet<Group>(list);

        criteria = currentSession().createCriteria(Group.class);
        criteria.createAlias("members", "m");
        criteria.add(Restrictions.eq("m.email", account.getEmail()));
        list = criteria.list();
        if (list != null)
            groups.addAll(list);
        return groups;
    }

Replace Generic With Diamond HashSet<Group> with HashSet<> in method public retrieveMemberGroups(account Account) : Set<Group> from class org.jbei.ice.storage.hibernate.dao.GroupDAO


    @GET
    @Path("/site")
    @Produces(MediaType.APPLICATION_JSON)
    public ArrayList<Setting> getSiteSettings() {
        ArrayList<Setting> settings = new ArrayList<>();

        settings.add(new Setting("logo",
                alt(Utils.getConfigValue(ConfigurationKey.LOGO), "rest/file/asset/logo.png")));

        settings.add(new Setting("loginMessage",
                alt(Utils.getConfigValue(ConfigurationKey.LOGIN_MESSAGE), "rest/file/asset/institution.html")));

        settings.add(new Setting("footer",
                alt(Utils.getConfigValue(ConfigurationKey.FOOTER), "rest/file/asset/footer.html")));

        settings.add(new Setting("version", "4.5.3"));

        return settings;
    }

    @GET
    @Path("/site")
    @Produces(MediaType.APPLICATION_JSON)
    public ArrayList<Setting> getSiteSettings() {
        ArrayList<Setting> settings = new ArrayList<Setting>();

        settings.add(new Setting("logo",
                alt(Utils.getConfigValue(ConfigurationKey.LOGO), "rest/file/asset/logo.png")));

        settings.add(new Setting("loginMessage",
                alt(Utils.getConfigValue(ConfigurationKey.LOGIN_MESSAGE), "rest/file/asset/institution.html")));

        settings.add(new Setting("footer",
                alt(Utils.getConfigValue(ConfigurationKey.FOOTER), "rest/file/asset/footer.html")));

        settings.add(new Setting("version", "4.5.3"));

        return settings;
    }

Replace Generic With Diamond ArrayList<Setting> with ArrayList<> in method public getSiteSettings() : ArrayList<Setting> from class org.jbei.ice.services.rest.ConfigResource


    /**
     * Retrieve a list of {@link SequenceFeature}s with the identical hash as the given feature.
     *
     * @param feature Feature to find.
     * @return List of {@link SequenceFeature}s.
     */
    public List<SequenceFeature> get(Feature feature) {
        ArrayList<SequenceFeature> result = new ArrayList<>();
        for (int i = 0; i < hashes.size(); i++) {
            if (hashes.get(i).equals(feature.getHash())) {
                result.add(sequenceFeatures.get(i));
            }
        }
        return result;
    }

    /**
     * Retrieve a list of {@link SequenceFeature}s with the identical hash as the given feature.
     *
     * @param feature Feature to find.
     * @return List of {@link SequenceFeature}s.
     */
    public List<SequenceFeature> get(Feature feature) {
        ArrayList<SequenceFeature> result = new ArrayList<SequenceFeature>();
        for (int i = 0; i < hashes.size(); i++) {
            if (hashes.get(i).equals(feature.getHash())) {
                result.add(sequenceFeatures.get(i));
            }
        }
        return result;
    }

Replace Generic With Diamond ArrayList<SequenceFeature> with ArrayList<> in method public get(feature Feature) : List<SequenceFeature> from class org.jbei.ice.lib.utils.SequenceFeatureCollection


    /**
     * Retrieve a list of {@link SequenceFeature}s with the given
     * {@link org.jbei.ice.lib.models.SequenceFeature.AnnotationType SequenceFeature.AnnotationType}
     * .
     *
     * @param flag AnnotationType to search for.
     * @return List of SequenceFeatures.
     */
    public List<SequenceFeature> get(SequenceFeature.AnnotationType flag) {
        ArrayList<SequenceFeature> result = new ArrayList<>();
        for (SequenceFeature sequenceFeature : sequenceFeatures) {
            if (sequenceFeature.getAnnotationType() == flag) {
                result.add(sequenceFeature);
            }
        }
        return result;
    }

    /**
     * Retrieve a list of {@link SequenceFeature}s with the given
     * {@link org.jbei.ice.lib.models.SequenceFeature.AnnotationType SequenceFeature.AnnotationType}
     * .
     *
     * @param flag AnnotationType to search for.
     * @return List of SequenceFeatures.
     */
    public List<SequenceFeature> get(SequenceFeature.AnnotationType flag) {
        ArrayList<SequenceFeature> result = new ArrayList<SequenceFeature>();
        for (SequenceFeature sequenceFeature : sequenceFeatures) {
            if (sequenceFeature.getAnnotationType() == flag) {
                result.add(sequenceFeature);
            }
        }
        return result;
    }

Replace Generic With Diamond ArrayList<SequenceFeature> with ArrayList<> in method public get(flag SequenceFeature.AnnotationType) : List<SequenceFeature> from class org.jbei.ice.lib.utils.SequenceFeatureCollection


    @Override
    public Set<Class<?>> getClasses() {
        final Set<Class<?>> classes = new HashSet<>();
        // register resources and features
        classes.add(MultiPartFeature.class);
        classes.add(FileResource.class);
        classes.add(AuthenticationInterceptor.class);
        return classes;
    }

    @Override
    public Set<Class<?>> getClasses() {
        final Set<Class<?>> classes = new HashSet<Class<?>>();
        // register resources and features
        classes.add(MultiPartFeature.class);
        classes.add(FileResource.class);
        classes.add(AuthenticationInterceptor.class);
        return classes;
    }

Replace Generic With Diamond HashSet<Class<?>> with HashSet<> in method public getClasses() : Set<Class<?>> from class org.jbei.ice.services.rest.multipart.IceApplication


    @SuppressWarnings("unchecked")
    public ArrayList<Entry> retrieveFolderContents(long folderId, ColumnField sort, boolean asc, int start, int limit) {
        Session session = currentSession();

        try {
            Folder folder = get(folderId);
            if (folder == null)
                throw new DAOException("Could not locate folder with id " + folderId);

            String sortString;

            switch (sort) {
                default:
                case CREATED:
                    sortString = "id";
                    break;

                case STATUS:
                    sortString = "status";
                    break;

                case NAME:
                    sortString = "name";
                    break;

                case PART_ID:
                    sortString = "partNumber";
                    break;

                case TYPE:
                    sortString = "recordType";
                    break;
            }

            String ascString = asc ? " asc" : " desc";
            String queryString = "select distinct e from Entry e join e.folders f where f.id = :id "
                    + "order by e." + sortString + ascString;

            Query query = session.createQuery(queryString);
            query.setLong("id", folderId);
            query.setFirstResult(start);
            query.setMaxResults(limit);
            List list = query.list();
            return new ArrayList<>(list);
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    @SuppressWarnings("unchecked")
    public ArrayList<Entry> retrieveFolderContents(long folderId, ColumnField sort, boolean asc, int start, int limit) {
        Session session = currentSession();

        try {
            Folder folder = get(folderId);
            if (folder == null)
                throw new DAOException("Could not locate folder with id " + folderId);

            String sortString;

            switch (sort) {
                default:
                case CREATED:
                    sortString = "id";
                    break;

                case STATUS:
                    sortString = "status";
                    break;

                case NAME:
                    sortString = "name";
                    break;

                case PART_ID:
                    sortString = "partNumber";
                    break;

                case TYPE:
                    sortString = "recordType";
                    break;
            }

            String ascString = asc ? " asc" : " desc";
            String queryString = "select distinct e from Entry e join e.folders f where f.id = :id "
                    + "order by e." + sortString + ascString;

            Query query = session.createQuery(queryString);
            query.setLong("id", folderId);
            query.setFirstResult(start);
            query.setMaxResults(limit);
            List list = query.list();
            return new ArrayList<Entry>(list);
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond ArrayList<Entry> with ArrayList<> in method public retrieveFolderContents(folderId long, sort ColumnField, asc boolean, start int, limit int) : ArrayList<Entry> from class org.jbei.ice.lib.dao.hibernate.FolderDAO


    /**
     * Retrieve all {@link Folder}s owned by given the {@link Account}.
     *
     * @param account owner account
     * @return List of Folder objects.
     * @throws DAOException
     */
    @SuppressWarnings("unchecked")
    public List<Folder> getFoldersByOwner(Account account) {
        ArrayList<Folder> folders;
        Session session = currentSession();
        try {
            String queryString = "from " + Folder.class.getName()
                    + " WHERE ownerEmail = :ownerEmail order by creationTime desc";
            Query query = session.createQuery(queryString);

            query.setParameter("ownerEmail", account.getEmail());
            folders = new ArrayList<>(query.list());
        } catch (HibernateException e) {
            Logger.error(e);
            throw new DAOException("Failed to retrieve folders!", e);
        }

        return folders;
    }

    /**
     * Retrieve all {@link Folder}s owned by given the {@link Account}.
     *
     * @param account owner account
     * @return List of Folder objects.
     * @throws DAOException
     */
    @SuppressWarnings("unchecked")
    public List<Folder> getFoldersByOwner(Account account) {
        ArrayList<Folder> folders;
        Session session = currentSession();
        try {
            String queryString = "from " + Folder.class.getName()
                    + " WHERE ownerEmail = :ownerEmail order by creationTime desc";
            Query query = session.createQuery(queryString);

            query.setParameter("ownerEmail", account.getEmail());
            folders = new ArrayList<Folder>(query.list());
        } catch (HibernateException e) {
            Logger.error(e);
            throw new DAOException("Failed to retrieve folders!", e);
        }

        return folders;
    }

Replace Generic With Diamond ArrayList<Folder> with ArrayList<> in method public getFoldersByOwner(account Account) : List<Folder> from class org.jbei.ice.lib.dao.hibernate.FolderDAO


    @SuppressWarnings("unchecked")
    public List<Folder> getFoldersByType(FolderType type) {
        ArrayList<Folder> folders;
        Session session = currentSession();
        try {
            String queryString = "from " + Folder.class.getName() + " WHERE type = :type";
            Query query = session.createQuery(queryString);
            query.setParameter("type", type);
            folders = new ArrayList<>(query.list());
        } catch (HibernateException e) {
            Logger.error(e);
            throw new DAOException("Failed to retrieve folders!", e);
        }

        return folders;
    }

    @SuppressWarnings("unchecked")
    public List<Folder> getFoldersByType(FolderType type) {
        ArrayList<Folder> folders;
        Session session = currentSession();
        try {
            String queryString = "from " + Folder.class.getName() + " WHERE type = :type";
            Query query = session.createQuery(queryString);
            query.setParameter("type", type);
            folders = new ArrayList<Folder>(query.list());
        } catch (HibernateException e) {
            Logger.error(e);
            throw new DAOException("Failed to retrieve folders!", e);
        }

        return folders;
    }

Replace Generic With Diamond ArrayList<Folder> with ArrayList<> in method public getFoldersByType(type FolderType) : List<Folder> from class org.jbei.ice.lib.dao.hibernate.FolderDAO


    public Set<Account> retrieveAccountPermissions(Folder folder, boolean canWrite, boolean canRead) {
        Session session = currentSession();
        try {
            List list = session.createCriteria(Permission.class)
                    .add(Restrictions.eq("canWrite", canWrite))
                    .add(Restrictions.eq("canRead", canRead))
                    .add(Restrictions.eq("folder", folder))
                    .setProjection(Projections.property("account"))
                    .add(Restrictions.isNotNull("account"))
                    .list();

            return new HashSet<>(list);
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    public Set<Account> retrieveAccountPermissions(Folder folder, boolean canWrite, boolean canRead) {
        Session session = currentSession();
        try {
            List list = session.createCriteria(Permission.class)
                               .add(Restrictions.eq("canWrite", canWrite))
                               .add(Restrictions.eq("canRead", canRead))
                               .add(Restrictions.eq("folder", folder))
                               .setProjection(Projections.property("account"))
                               .add(Restrictions.isNotNull("account"))
                               .list();

            return new HashSet<Account>(list);
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond HashSet<Account> with HashSet<> in method public retrieveAccountPermissions(folder Folder, canWrite boolean, canRead boolean) : Set<Account> from class org.jbei.ice.lib.dao.hibernate.PermissionDAO


    public Set<Group> retrieveGroupPermissions(Folder folder, boolean canWrite, boolean canRead) throws DAOException {
        Session session = currentSession();
        try {
            List list = session.createCriteria(Permission.class)
                    .add(Restrictions.eq("folder", folder))
                    .add(Restrictions.eq("canWrite", canWrite))
                    .add(Restrictions.eq("canRead", canRead))
                    .setProjection(Projections.property("group"))
                    .add(Restrictions.isNotNull("group"))
                    .list();
            return new HashSet<>(list);
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    public Set<Group> retrieveGroupPermissions(Folder folder, boolean canWrite, boolean canRead) throws DAOException {
        Session session = currentSession();
        try {
            List list = session.createCriteria(Permission.class)
                               .add(Restrictions.eq("folder", folder))
                               .add(Restrictions.eq("canWrite", canWrite))
                               .add(Restrictions.eq("canRead", canRead))
                               .setProjection(Projections.property("group"))
                               .add(Restrictions.isNotNull("group"))
                               .list();
            return new HashSet<Group>(list);
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond HashSet<Group> with HashSet<> in method public retrieveGroupPermissions(folder Folder, canWrite boolean, canRead boolean) : Set<Group> from class org.jbei.ice.lib.dao.hibernate.PermissionDAO


    public Set<Folder> retrieveFolderPermissions(Account account, Set<Group> accountGroups) throws DAOException {
        // can read or can write
        Criterion criterion = Restrictions.disjunction()
                .add(Restrictions.eq("canWrite", true))
                .add(Restrictions.eq("canRead", true));
        Session session = currentSession();
        try {
            List list = session.createCriteria(Permission.class)
                    .add(Restrictions.isNull("entry"))
                    .add(Restrictions.disjunction()
                            .add(Restrictions.in("group", accountGroups))
                            .add(Restrictions.eq("account", account)))
                    .add(criterion)
                    .setProjection(Projections.property("folder"))
                    .add(Restrictions.isNotNull("folder"))
                    .list();
            return new HashSet<>(list);
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    public Set<Folder> retrieveFolderPermissions(Account account, Set<Group> accountGroups) throws DAOException {
        // can read or can write
        Criterion criterion = Restrictions.disjunction()
                                          .add(Restrictions.eq("canWrite", true))
                                          .add(Restrictions.eq("canRead", true));
        Session session = currentSession();
        try {
            List list = session.createCriteria(Permission.class)
                               .add(Restrictions.isNull("entry"))
                               .add(Restrictions.disjunction()
                                                .add(Restrictions.in("group", accountGroups))
                                                .add(Restrictions.eq("account", account)))
                               .add(criterion)
                               .setProjection(Projections.property("folder"))
                               .add(Restrictions.isNotNull("folder"))
                               .list();
            return new HashSet<Folder>(list);
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond HashSet<Folder> with HashSet<> in method public retrieveFolderPermissions(account Account, accountGroups Set<Group>) : Set<Folder> from class org.jbei.ice.lib.dao.hibernate.PermissionDAO


    public Set<Folder> getFolders(Group group) {
        Criterion criterion = Restrictions.disjunction()
                .add(Restrictions.eq("canWrite", true))
                .add(Restrictions.eq("canRead", true));
        Session session = currentSession();
        try {
            List list = session.createCriteria(Permission.class)
                    .add(Restrictions.isNull("entry"))
                    .add(Restrictions.eq("group", group))
                    .add(criterion)
                    .add(Restrictions.isNotNull("folder"))
                    .setProjection(Projections.property("folder"))
                    .list();
            return new HashSet<>(list);
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    public Set<Folder> getFolders(Group group) {
        Criterion criterion = Restrictions.disjunction()
                                          .add(Restrictions.eq("canWrite", true))
                                          .add(Restrictions.eq("canRead", true));
        Session session = currentSession();
        try {
            List list = session.createCriteria(Permission.class)
                               .add(Restrictions.isNull("entry"))
                               .add(Restrictions.eq("group", group))
                               .add(criterion)
                               .add(Restrictions.isNotNull("folder"))
                               .setProjection(Projections.property("folder"))
                               .list();
            return new HashSet<Folder>(list);
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond HashSet<Folder> with HashSet<> in method public getFolders(group Group) : Set<Folder> from class org.jbei.ice.lib.dao.hibernate.PermissionDAO


    public List<Request> get(int start, int limit, String sort, boolean asc, SampleRequestStatus status, String filter)
            throws DAOException {
        String sql = "from " + Request.class.getName() + " request";
        if (filter != null) {
            filter = filter.toUpperCase();
            sql += " where UPPER(account.firstName) like '" + filter + "%' OR UPPER(account.lastName) like '" +
                    filter + "%'";
        }

        sql += " order by " + sort;
        sql += asc ? " asc" : " desc";

        Query query = currentSession().createQuery(sql);
        query.setMaxResults(limit);
        query.setFirstResult(start);

        try {
            return new ArrayList<>(query.list());
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    public List<Request> get(int start, int limit, String sort, boolean asc, SampleRequestStatus status, String filter)
            throws DAOException {
        String sql = "from " + Request.class.getName() + " request";
        if (filter != null) {
            filter = filter.toUpperCase();
            sql += " where UPPER(account.firstName) like '" + filter + "%' OR UPPER(account.lastName) like '" +
                    filter + "%'";
        }

        sql += " order by " + sort;
        sql += asc ? " asc" : " desc";

        Query query = currentSession().createQuery(sql);
        query.setMaxResults(limit);
        query.setFirstResult(start);

        try {
            return new ArrayList<Request>(query.list());
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond ArrayList<Request> with ArrayList<> in method public get(start int, limit int, sort String, asc boolean, status SampleRequestStatus, filter String) : List<Request> from class org.jbei.ice.lib.dao.hibernate.RequestDAO


    public List<Request> getAccountRequests(Account account, SampleRequestStatus status, int start, int limit,
            String sort, boolean asc) throws DAOException {
        String sql = "from " + Request.class.getName() + " request where account=:account";
        if (status != null) {
            sql += " and status=:status";
        }

        sql += " order by " + sort;
        sql += asc ? " asc" : " desc";

        Query query = currentSession().createQuery(sql);
        query.setParameter("account", account);
        if (status != null)
            query.setParameter("status", status);
        query.setMaxResults(limit);
        query.setFirstResult(start);

        try {
            return new ArrayList<>(query.list());
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    public List<Request> getAccountRequests(Account account, SampleRequestStatus status, int start, int limit,
            String sort, boolean asc) throws DAOException {
        String sql = "from " + Request.class.getName() + " request where account=:account";
        if (status != null) {
            sql += " and status=:status";
        }

        sql += " order by " + sort;
        sql += asc ? " asc" : " desc";

        Query query = currentSession().createQuery(sql);
        query.setParameter("account", account);
        if (status != null)
            query.setParameter("status", status);
        query.setMaxResults(limit);
        query.setFirstResult(start);

        try {
            return new ArrayList<Request>(query.list());
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond ArrayList<Request> with ArrayList<> in method public getAccountRequests(account Account, status SampleRequestStatus, start int, limit int, sort String, asc boolean) : List<Request> from class org.jbei.ice.lib.dao.hibernate.RequestDAO


    @SuppressWarnings("unchecked")
    public Set<String> getMatchingPlasmidPartNumbers(String token, int limit) throws DAOException {
        try {
            token = token.toUpperCase();
            String qString = "select distinct plasmid.partNumber from Plasmid plasmid where UPPER(plasmid.partNumber) "
                    + "like '%" + token + "%'";
            Query query = currentSession().createQuery(qString);
            if (limit > 0)
                query.setMaxResults(limit);

            return new HashSet<>(query.list());
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    @SuppressWarnings("unchecked")
    public Set<String> getMatchingPlasmidPartNumbers(String token, int limit) throws DAOException {
        try {
            token = token.toUpperCase();
            String qString = "select distinct plasmid.partNumber from Plasmid plasmid where UPPER(plasmid.partNumber) "
                    + "like '%" + token + "%'";
            Query query = currentSession().createQuery(qString);
            if (limit > 0)
                query.setMaxResults(limit);

            return new HashSet<String>(query.list());
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method public getMatchingPlasmidPartNumbers(token String, limit int) : Set<String> from class org.jbei.ice.lib.dao.hibernate.EntryDAO


    /**
     * Retrieve {@link Entry Entries} visible to everyone.
     *
     * @return Number of visible entries.
     * @throws DAOException on hibernate exception
     */
    @SuppressWarnings({"unchecked"})
    public Set<Entry> retrieveVisibleEntries(Account account, Set<Group> groups, ColumnField sortField, boolean asc,
            int start, int count) throws DAOException {
        try {
            Session session = currentSession();
            String fieldName = columnFieldToString(sortField);
            String ascString = asc ? " asc" : " desc";
            String queryString = "SELECT DISTINCT e FROM Entry e, Permission p WHERE ";
            if (account != null)
                queryString += "(p.group IN (:groups) OR p.account = :account)";
            else
                queryString += "p.group IN (:groups)";

            queryString += " AND e = p.entry AND e.visibility = :v ORDER BY e." + fieldName + ascString;

            Query query = session.createQuery(queryString);
            query.setParameterList("groups", groups);
            query.setParameter("v", Visibility.OK.getValue());
            if (account != null)
                query.setParameter("account", account);
            query.setFirstResult(start);
            query.setMaxResults(count);
            List list = query.list();
            return new LinkedHashSet<>(list);
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    /**
     * Retrieve {@link Entry Entries} visible to everyone.
     *
     * @return Number of visible entries.
     * @throws DAOException on hibernate exception
     */
    @SuppressWarnings({"unchecked"})
    public Set<Entry> retrieveVisibleEntries(Account account, Set<Group> groups, ColumnField sortField, boolean asc,
            int start, int count) throws DAOException {
        try {
            Session session = currentSession();
            String fieldName = columnFieldToString(sortField);
            String ascString = asc ? " asc" : " desc";
            String queryString = "SELECT DISTINCT e FROM Entry e, Permission p WHERE ";
            if (account != null)
                queryString += "(p.group IN (:groups) OR p.account = :account)";
            else
                queryString += "p.group IN (:groups)";

            queryString += " AND e = p.entry AND e.visibility = :v ORDER BY e." + fieldName + ascString;

            Query query = session.createQuery(queryString);
            query.setParameterList("groups", groups);
            query.setParameter("v", Visibility.OK.getValue());
            if (account != null)
                query.setParameter("account", account);
            query.setFirstResult(start);
            query.setMaxResults(count);
            List list = query.list();
            return new LinkedHashSet<Entry>(list);
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond LinkedHashSet<Entry> with LinkedHashSet<> in method public retrieveVisibleEntries(account Account, groups Set<Group>, sortField ColumnField, asc boolean, start int, count int) : Set<Entry> from class org.jbei.ice.lib.dao.hibernate.EntryDAO


    @SuppressWarnings("unchecked")
    public List<Entry> retrieveUserEntries(Account requestor, String user, Set<Group> groups,
            ColumnField sortField, boolean asc, int start, int limit) throws DAOException {
        Session session = currentSession();
        Criteria criteria = session.createCriteria(Permission.class);
        criteria.setProjection(Projections.property("entry"));

        // expect everyone to at least belong to the everyone group so groups should never be empty
        Junction disjunction = Restrictions.disjunction().add(Restrictions.in("group", groups));
        disjunction.add(Restrictions.eq("account", requestor));

        criteria.add(disjunction);
        criteria.add(Restrictions.disjunction()
                                 .add(Restrictions.eq("canWrite", true))
                                 .add(Restrictions.eq("canRead", true)));

        Criteria entryCriteria = criteria.createCriteria("entry");
        entryCriteria.add(Restrictions.disjunction()
                                      .add(Restrictions.eq("visibility", Visibility.OK.getValue()))
                                      .add(Restrictions.isNull("visibility")));
        entryCriteria.add(Restrictions.eq("ownerEmail", user));

        // sort
        String fieldName = columnFieldToString(sortField);

        entryCriteria.addOrder(asc ? Order.asc(fieldName) : Order.desc(fieldName));
        entryCriteria.setFirstResult(start);
        entryCriteria.setMaxResults(limit);
        entryCriteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
        return new LinkedList<>(entryCriteria.list());
    }

    @SuppressWarnings("unchecked")
    public List<Entry> retrieveUserEntries(Account requestor, String user, Set<Group> groups,
            ColumnField sortField, boolean asc, int start, int limit) throws DAOException {
        Session session = currentSession();
        Criteria criteria = session.createCriteria(Permission.class);
        criteria.setProjection(Projections.property("entry"));

        // expect everyone to at least belong to the everyone group so groups should never be empty
        Junction disjunction = Restrictions.disjunction().add(Restrictions.in("group", groups));
        disjunction.add(Restrictions.eq("account", requestor));

        criteria.add(disjunction);
        criteria.add(Restrictions.disjunction()
                                 .add(Restrictions.eq("canWrite", true))
                                 .add(Restrictions.eq("canRead", true)));

        Criteria entryCriteria = criteria.createCriteria("entry");
        entryCriteria.add(Restrictions.disjunction()
                                      .add(Restrictions.eq("visibility", Visibility.OK.getValue()))
                                      .add(Restrictions.isNull("visibility")));
        entryCriteria.add(Restrictions.eq("ownerEmail", user));

        // sort
        String fieldName = columnFieldToString(sortField);

        entryCriteria.addOrder(asc ? Order.asc(fieldName) : Order.desc(fieldName));
        entryCriteria.setFirstResult(start);
        entryCriteria.setMaxResults(limit);
        entryCriteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
        return new LinkedList<Entry>(entryCriteria.list());
    }

Replace Generic With Diamond LinkedList<Entry> with LinkedList<> in method public retrieveUserEntries(requestor Account, user String, groups Set<Group>, sortField ColumnField, asc boolean, start int, limit int) : List<Entry> from class org.jbei.ice.lib.dao.hibernate.EntryDAO


    /**
     * Retrieve {@link Entry} objects of the given list of ids.
     *
     * @param ids list of ids to retrieve
     * @return ArrayList of Entry objects.
     * @throws DAOException
     */
    @SuppressWarnings("unchecked")
    public List<Entry> getEntriesByIdSet(List<Long> ids) throws DAOException {
        if (ids == null || ids.isEmpty()) {
            return new LinkedList<>();
        }

        try {
            Query query = currentSession().createQuery(
                    "FROM " + Entry.class.getName() + " e WHERE e.id IN (:ids) order by id asc");
            ArrayList<Long> list = new ArrayList<>(ids.size());
            for (Number id : ids) {
                list.add(id.longValue());
            }
            query.setParameterList("ids", list);
            List result = query.list();
            return new LinkedList<>(result);
        } catch (HibernateException e) {
            Logger.error(e);
            throw new DAOException("Failed to retrieve entries!", e);
        }
    }

    /**
     * Retrieve {@link Entry} objects of the given list of ids.
     *
     * @param ids list of ids to retrieve
     * @return ArrayList of Entry objects.
     * @throws DAOException
     */
    @SuppressWarnings("unchecked")
    public List<Entry> getEntriesByIdSet(List<Long> ids) throws DAOException {
        if (ids == null || ids.isEmpty()) {
            return new LinkedList<>();
        }

        try {
            Query query = currentSession().createQuery(
                    "FROM " + Entry.class.getName() + " e WHERE e.id IN (:ids) order by id asc");
            ArrayList<Long> list = new ArrayList<>(ids.size());
            for (Number id : ids) {
                list.add(id.longValue());
            }
            query.setParameterList("ids", list);
            List result = query.list();
            return new LinkedList<Entry>(result);
        } catch (HibernateException e) {
            Logger.error(e);
            throw new DAOException("Failed to retrieve entries!", e);
        }
    }

Replace Generic With Diamond LinkedList<Entry> with LinkedList<> in method public getEntriesByIdSet(ids List<Long>) : List<Entry> from class org.jbei.ice.lib.dao.hibernate.EntryDAO


    public synchronized void generateNextStrainNameForEntry(Entry entry, String prefix) throws DAOException {
        Session session = currentSession();
        String queryString = "select name from entries where (LEFT(name, 6)) in (";
        for (int i = 0; i < 10; i += 1) {
            if (i != 0)
                queryString += ", ";
            queryString += ("\'" + prefix + i + "\'");
        }
        queryString += ") ORDER by name DESC";
        Query query = session.createSQLQuery(queryString);
        query.setMaxResults(5);
        List results;
        try {
            results = query.list();
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }

        if (results.isEmpty()) {
            String name = prefix + "0001";
            entry.setName(name);
            session.update(entry);
            return;
        }

        @SuppressWarnings("unchecked")
        ArrayList<Object> tempList = new ArrayList<>(results);
        for (int i = 0; i < results.size(); i += 1) {
            String name = (String) tempList.get(i);
            String[] split = name.split(prefix);
            if (split.length != 2)
                continue;

            try {
                int value = Integer.valueOf(split[1]);
                value += 1;
                entry.setName(prefix + String.format("%0" + 4 + "d", value));
                session.update(entry);
                return;
            } catch (NumberFormatException nfe) {
                Logger.warn(nfe.getMessage());
            }
        }

        throw new DAOException("Could not parse any of the retrieved strain names");
    }

    public synchronized void generateNextStrainNameForEntry(Entry entry, String prefix) throws DAOException {
        Session session = currentSession();
        String queryString = "select name from entries where (LEFT(name, 6)) in (";
        for (int i = 0; i < 10; i += 1) {
            if (i != 0)
                queryString += ", ";
            queryString += ("\'" + prefix + i + "\'");
        }
        queryString += ") ORDER by name DESC";
        Query query = session.createSQLQuery(queryString);
        query.setMaxResults(5);
        List results;
        try {
            results = query.list();
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }

        if (results.isEmpty()) {
            String name = prefix + "0001";
            entry.setName(name);
            session.update(entry);
            return;
        }

        @SuppressWarnings("unchecked")
        ArrayList<Object> tempList = new ArrayList<Object>(results);
        for (int i = 0; i < results.size(); i += 1) {
            String name = (String) tempList.get(i);
            String[] split = name.split(prefix);
            if (split.length != 2)
                continue;

            try {
                int value = Integer.valueOf(split[1]);
                value += 1;
                entry.setName(prefix + String.format("%0" + 4 + "d", value));
                session.update(entry);
                return;
            } catch (NumberFormatException nfe) {
                Logger.warn(nfe.getMessage());
            }
        }

        throw new DAOException("Could not parse any of the retrieved strain names");
    }

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method public generateNextStrainNameForEntry(entry Entry, prefix String) : void from class org.jbei.ice.lib.dao.hibernate.EntryDAO


    @SuppressWarnings("unchecked")
    public List<Entry> retrieveOwnerEntries(String ownerEmail, ColumnField sort, boolean asc, int start, int limit)
            throws DAOException {
        try {
            String fieldName = columnFieldToString(sort);
            Session session = currentSession();
            String orderSuffix = (" ORDER BY e." + fieldName + " " + (asc ? "ASC" : "DESC"));
            String queryString = "from " + Entry.class.getName() + " e where owner_email = :oe "
                    + "AND (visibility is null or visibility = " + Visibility.OK.getValue() + " OR visibility = "
                    + Visibility.PENDING.getValue() + ")" + orderSuffix;
            Query query = session.createQuery(queryString);
            query.setParameter("oe", ownerEmail);
            query.setMaxResults(limit);
            query.setFirstResult(start);
            List list = query.list();
            return new LinkedList<>(list);
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    @SuppressWarnings("unchecked")
    public List<Entry> retrieveOwnerEntries(String ownerEmail, ColumnField sort, boolean asc, int start, int limit)
            throws DAOException {
        try {
            String fieldName = columnFieldToString(sort);
            Session session = currentSession();
            String orderSuffix = (" ORDER BY e." + fieldName + " " + (asc ? "ASC" : "DESC"));
            String queryString = "from " + Entry.class.getName() + " e where owner_email = :oe "
                    + "AND (visibility is null or visibility = " + Visibility.OK.getValue() + " OR visibility = "
                    + Visibility.PENDING.getValue() + ")" + orderSuffix;
            Query query = session.createQuery(queryString);
            query.setParameter("oe", ownerEmail);
            query.setMaxResults(limit);
            query.setFirstResult(start);
            List list = query.list();
            return new LinkedList<Entry>(list);
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond LinkedList<Entry> with LinkedList<> in method public retrieveOwnerEntries(ownerEmail String, sort ColumnField, asc boolean, start int, limit int) : List<Entry> from class org.jbei.ice.lib.dao.hibernate.EntryDAO


    @SuppressWarnings("unchecked")
    public Set<Entry> retrieveAllEntries(ColumnField sort, boolean asc, int start, int limit)
            throws DAOException {
        try {
            if (sort == null)
                sort = ColumnField.CREATED;

            String fieldName;
            switch (sort) {
                case TYPE:
                    fieldName = "recordType";
                    break;

                case STATUS:
                    fieldName = "status";
                    break;

                case NAME:
                    fieldName = "name";
                    break;

                case PART_ID:
                    fieldName = "partNumber";
                    break;

                case SUMMARY:
                    fieldName = "shortDescription";
                    break;

                case CREATED:
                default:
                    fieldName = "creationTime";
                    break;
            }

            Session session = currentSession();
            String orderSuffix = (" ORDER BY e." + fieldName + " " + (asc ? "ASC" : "DESC"));
            String queryString = "from " + Entry.class.getName() + " e where (visibility is null or visibility = "
                    + Visibility.OK.getValue() + " OR visibility = "
                    + Visibility.PENDING.getValue() + ")" + orderSuffix;
            Query query = session.createQuery(queryString);
            query.setMaxResults(limit);
            query.setFirstResult(start);
            List list = query.list();
            return new LinkedHashSet<>(list);
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    @SuppressWarnings("unchecked")
    public Set<Entry> retrieveAllEntries(ColumnField sort, boolean asc, int start, int limit)
            throws DAOException {
        try {
            if (sort == null)
                sort = ColumnField.CREATED;

            String fieldName;
            switch (sort) {
                case TYPE:
                    fieldName = "recordType";
                    break;

                case STATUS:
                    fieldName = "status";
                    break;

                case NAME:
                    fieldName = "name";
                    break;

                case PART_ID:
                    fieldName = "partNumber";
                    break;

                case SUMMARY:
                    fieldName = "shortDescription";
                    break;

                case CREATED:
                default:
                    fieldName = "creationTime";
                    break;
            }

            Session session = currentSession();
            String orderSuffix = (" ORDER BY e." + fieldName + " " + (asc ? "ASC" : "DESC"));
            String queryString = "from " + Entry.class.getName() + " e where (visibility is null or visibility = "
                    + Visibility.OK.getValue() + " OR visibility = "
                    + Visibility.PENDING.getValue() + ")" + orderSuffix;
            Query query = session.createQuery(queryString);
            query.setMaxResults(limit);
            query.setFirstResult(start);
            List list = query.list();
            return new LinkedHashSet<Entry>(list);
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond LinkedHashSet<Entry> with LinkedHashSet<> in method public retrieveAllEntries(sort ColumnField, asc boolean, start int, limit int) : Set<Entry> from class org.jbei.ice.lib.dao.hibernate.EntryDAO


    /**
     * Retrieve all {@link Sequence} objects in the database.
     *
     * @return ArrayList of Sequence objects.
     * @throws DAOException
     */
    @SuppressWarnings("unchecked")
    public Set<Sequence> getAllSequences() {
        Session session = currentSession();
        try {
            Criteria criteria = session.createCriteria(Sequence.class);

            Criteria entryC = criteria.createCriteria("entry", "entry");
            entryC.add(Restrictions.disjunction()
                                   .add(Restrictions.eq("visibility", Visibility.OK.getValue()))
                                   .add(Restrictions.isNull("visibility"))
                                   .add(Restrictions.ne("ownerEmail", "system")));

            return new LinkedHashSet<>(criteria.list());
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    /**
     * Retrieve all {@link Sequence} objects in the database.
     *
     * @return ArrayList of Sequence objects.
     * @throws DAOException
     */
    @SuppressWarnings("unchecked")
    public Set<Sequence> getAllSequences() {
        Session session = currentSession();
        try {
            Criteria criteria = session.createCriteria(Sequence.class);

            Criteria entryC = criteria.createCriteria("entry", "entry");
            entryC.add(Restrictions.disjunction()
                                   .add(Restrictions.eq("visibility", Visibility.OK.getValue()))
                                   .add(Restrictions.isNull("visibility"))
                                   .add(Restrictions.ne("ownerEmail", "system")));

            return new LinkedHashSet<Sequence>(criteria.list());
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond LinkedHashSet<Sequence> with LinkedHashSet<> in method public getAllSequences() : Set<Sequence> from class org.jbei.ice.lib.dao.hibernate.SequenceDAO


    @SuppressWarnings("unchecked")
    protected Set<String> getMatchingField(String field, String object, String token, int limit) throws DAOException {
        Session session = currentSession();
        try {
            token = token.toUpperCase();
            String queryString = "select distinct " + field + " from " + object + " where "
                    + " UPPER(" + field + ") like '%" + token + "%'";
            Query query = session.createSQLQuery(queryString);
            if (limit > 0)
                query.setMaxResults(limit);
            return new HashSet<>(query.list());
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    @SuppressWarnings("unchecked")
    protected Set<String> getMatchingField(String field, String object, String token, int limit) throws DAOException {
        Session session = currentSession();
        try {
            token = token.toUpperCase();
            String queryString = "select distinct " + field + " from " + object + " where "
                    + " UPPER(" + field + ") like '%" + token + "%'";
            Query query = session.createSQLQuery(queryString);
            if (limit > 0)
                query.setMaxResults(limit);
            return new HashSet<String>(query.list());
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method protected getMatchingField(field String, object String, token String, limit int) : Set<String> from class org.jbei.ice.lib.dao.hibernate.EntryDAO


    @SuppressWarnings("unchecked")
    public Set<Entry> getMatchingEntryPartNumbers(String token, int limit) throws DAOException {
        try {
            token = token.toUpperCase();
            String qString = "select distinct entry from " + Entry.class.getName()
                    + " entry where UPPER(entry.partNumber) "
                    + "like '%" + token + "%'";
            Query query = currentSession().createQuery(qString);
            if (limit > 0)
                query.setMaxResults(limit);

            return new HashSet<>(query.list());
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    @SuppressWarnings("unchecked")
    public Set<Entry> getMatchingEntryPartNumbers(String token, int limit) throws DAOException {
        try {
            token = token.toUpperCase();
            String qString = "select distinct entry from " + Entry.class.getName()
                    + " entry where UPPER(entry.partNumber) "
                    + "like '%" + token + "%'";
            Query query = currentSession().createQuery(qString);
            if (limit > 0)
                query.setMaxResults(limit);

            return new HashSet<Entry>(query.list());
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond HashSet<Entry> with HashSet<> in method public getMatchingEntryPartNumbers(token String, limit int) : Set<Entry> from class org.jbei.ice.lib.dao.hibernate.EntryDAO


    @SuppressWarnings("unchecked")
    public ArrayList<BulkUpload> retrieveByAccount(Account account) throws DAOException {
        Session session = currentSession();
        ArrayList<BulkUpload> result;

        try {
            Query query = session.createQuery("from " + BulkUpload.class.getName() + " where account = :account AND "
                                                      + "status != :status");
            query.setParameter("account", account);
            query.setParameter("status", BulkUploadStatus.PENDING_APPROVAL);
            result = new ArrayList<>(query.list());
            return result;
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    @SuppressWarnings("unchecked")
    public ArrayList<BulkUpload> retrieveByAccount(Account account) throws DAOException {
        Session session = currentSession();
        ArrayList<BulkUpload> result;

        try {
            Query query = session.createQuery("from " + BulkUpload.class.getName() + " where account = :account AND "
                                                      + "status != :status");
            query.setParameter("account", account);
            query.setParameter("status", BulkUploadStatus.PENDING_APPROVAL);
            result = new ArrayList<BulkUpload>(query.list());
            return result;
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond ArrayList<BulkUpload> with ArrayList<> in method public retrieveByAccount(account Account) : ArrayList<BulkUpload> from class org.jbei.ice.lib.dao.hibernate.BulkUploadDAO


    @SuppressWarnings("unchecked")
    public ArrayList<BulkUpload> retrieveByStatus(BulkUploadStatus status) throws DAOException {
        Session session = currentSession();
        ArrayList<BulkUpload> result;

        try {
            Query query = session.createQuery("from " + BulkUpload.class.getName() + " where status = :status");
            query.setParameter("status", status);
            result = new ArrayList<>(query.list());
            return result;
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

    @SuppressWarnings("unchecked")
    public ArrayList<BulkUpload> retrieveByStatus(BulkUploadStatus status) throws DAOException {
        Session session = currentSession();
        ArrayList<BulkUpload> result;

        try {
            Query query = session.createQuery("from " + BulkUpload.class.getName() + " where status = :status");
            query.setParameter("status", status);
            result = new ArrayList<BulkUpload>(query.list());
            return result;
        } catch (HibernateException he) {
            Logger.error(he);
            throw new DAOException(he);
        }
    }

Replace Generic With Diamond ArrayList<BulkUpload> with ArrayList<> in method public retrieveByStatus(status BulkUploadStatus) : ArrayList<BulkUpload> from class org.jbei.ice.lib.dao.hibernate.BulkUploadDAO


    public AccountResults() {
        users = new LinkedList<>();
    }

    public AccountResults() {
        infos = new LinkedList<AccountTransfer>();
    }

Replace Generic With Diamond LinkedList<AccountTransfer> with LinkedList<> in method public AccountResults() from class org.jbei.ice.lib.dto.AccountResults


    /**
     * set the query default values
     */
    public SearchQuery() {
        entryTypes = new ArrayList<>(Arrays.asList(EntryType.values()));
        parameters = new Parameters();
    }

    /**
     * set the query default values
     */
    public SearchQuery() {
        entryTypes = new ArrayList<EntryType>(Arrays.asList(EntryType.values()));
        parameters = new Parameters();
    }

Replace Generic With Diamond ArrayList<EntryType> with ArrayList<> in method public SearchQuery() from class org.jbei.ice.lib.dto.search.SearchQuery


    public SearchResult() {
        matchDetails = new LinkedList<>();
        eValue = "0";
    }

    public SearchResult() {
        matchDetails = new LinkedList<String>();
        eValue = "0";
    }

Replace Generic With Diamond LinkedList<String> with LinkedList<> in method public SearchResult() from class org.jbei.ice.lib.dto.search.SearchResult


    public void setResults(LinkedList<SearchResult> results) {
        if (this.results == null)
            this.results = new LinkedList<>();

        this.results.clear();
        this.results.addAll(results);
    }

    public void setResults(LinkedList<SearchResult> results) {
        if (this.results == null)
            this.results = new LinkedList<SearchResult>();

        this.results.clear();
        this.results.addAll(results);
    }

Replace Generic With Diamond LinkedList<SearchResult> with LinkedList<> in method public setResults(results LinkedList<SearchResult>) : void from class org.jbei.ice.lib.dto.search.SearchResults


    public List<EntryField> getRequiredFields() {
        return new ArrayList<>(requiredFields);
    }

    public List<EntryField> getRequiredFields() {
        return new ArrayList<EntryField>(requiredFields);
    }

Replace Generic With Diamond ArrayList<EntryField> with ArrayList<> in method public getRequiredFields() : List<EntryField> from class org.jbei.ice.lib.bulkupload.BulkCSVUpload


    public BulkUploadAutoUpdate(EntryType type, EditMode mode) {
        this.type = type;
        keyValue = new HashMap<>();
        this.editMode = mode;
    }

    public BulkUploadAutoUpdate(EntryType type, EditMode mode) {
        this.type = type;
        keyValue = new HashMap<EntryField, String>();
        this.editMode = mode;
    }

Replace Generic With Diamond HashMap<EntryField,String> with HashMap<> in method public BulkUploadAutoUpdate(type EntryType, mode EditMode) from class org.jbei.ice.lib.bulkupload.BulkUploadAutoUpdate


    protected String validate(List<BulkUploadAutoUpdate> updates) {
        for (BulkUploadAutoUpdate update : updates) {
            ArrayList<EntryField> toValidate = new ArrayList<>(requiredFields);

            for (Map.Entry<EntryField, String> entry : update.getKeyValue().entrySet()) {
                EntryField entryField = entry.getKey();
                String value = entry.getValue();

                if (!requiredFields.contains(entryField))
                    continue;

                toValidate.remove(entryField);

                if (StringUtils.isBlank(value)) {
                    return "Error: \"" + entryField.toString() + "\" is a required field.";
                }
            }

            if (!toValidate.isEmpty()) {
                StringBuilder builder = new StringBuilder();
                builder.append("Error: File is missing the following required fields [");
                int i = 0;
                for (EntryField field : toValidate) {
                    if (i > 0)
                        builder.append(",");
                    builder.append(field.toString());
                    i += 1;
                }
                builder.append("]");
                return builder.toString();
            }
        }
        return null;
    }

    protected String validate(List<BulkUploadAutoUpdate> updates) {
        for (BulkUploadAutoUpdate update : updates) {
            ArrayList<EntryField> toValidate = new ArrayList<EntryField>(requiredFields);

            for (Map.Entry<EntryField, String> entry : update.getKeyValue().entrySet()) {
                EntryField entryField = entry.getKey();
                String value = entry.getValue();

                if (!requiredFields.contains(entryField))
                    continue;

                toValidate.remove(entryField);

                if (StringUtils.isBlank(value)) {
                    return "Error: \"" + entryField.toString() + "\" is a required field.";
                }
            }

            if (!toValidate.isEmpty()) {
                StringBuilder builder = new StringBuilder();
                builder.append("Error: File is missing the following required fields [");
                int i = 0;
                for (EntryField field : toValidate) {
                    if (i > 0)
                        builder.append(",");
                    builder.append(field.toString());
                    i += 1;
                }
                builder.append("]");
                return builder.toString();
            }
        }
        return null;
    }

Replace Generic With Diamond ArrayList<EntryField> with ArrayList<> in method protected validate(updates List<BulkUploadAutoUpdate>) : String from class org.jbei.ice.lib.bulkupload.PartBulkCSVUpload


    public ArrayList<Request> getSampleRequestByStatus(Account account, Entry entry, SampleRequestStatus status)
            throws DAOException {
        Criteria criteria = currentSession().createCriteria(Request.class.getName());
        criteria.add(Restrictions.eq("account", account));
        criteria.add(Restrictions.eq("entry", entry));
        criteria.add(Restrictions.eq("status", status));
        List list = criteria.list();
        if (list == null)
            return new ArrayList<>();
        return new ArrayList<Request>(list);
    }

    public ArrayList<Request> getSampleRequestByStatus(Account account, Entry entry, SampleRequestStatus status)
            throws DAOException {
        Criteria criteria = currentSession().createCriteria(Request.class.getName());
        criteria.add(Restrictions.eq("account", account));
        criteria.add(Restrictions.eq("entry", entry));
        criteria.add(Restrictions.eq("status", status));
        List list = criteria.list();
        if (list == null)
            return new ArrayList<Request>();
        return new ArrayList<Request>(list);
    }

Replace Generic With Diamond ArrayList<Request> with ArrayList<> in method public getSampleRequestByStatus(account Account, entry Entry, status SampleRequestStatus) : ArrayList<Request> from class org.jbei.ice.lib.entry.sample.RequestDAO