    @Test
    public void actualizarAgendaTest()
    {
        try {
            AgendaEntity agenda = agendaLogic.getAgenda(data.get(0).getId());
        Date dia = new Date();
        Calendar cal=Calendar.getInstance();
        cal.setTime(dia);
        cal.add(Calendar.DATE, 10);
        dia=cal.getTime();
        agenda.setFechaPenitencia(dia);

        String fechasNoLaborales=
                "{"
                + "\""+AgendaEntity.DiaSemana.LUNES.darValor()+"\":\""+ConstantesJornada.JORNADA_COMPLETA.darValor()+"\","
                + "\""+AgendaEntity.DiaSemana.MARTES.darValor()+"\":\""+ConstantesJornada.NINGUNA.darValor()+"\","
                + "\""+AgendaEntity.DiaSemana.MIERCOLES.darValor()+"\":\""+ConstantesJornada.JORNADA_COMPLETA.darValor()+"\","
                + "\""+AgendaEntity.DiaSemana.JUEVES.darValor()+"\":\""+ConstantesJornada.NINGUNA.darValor()+"\","
                + "\""+AgendaEntity.DiaSemana.VIERNES.darValor()+"\":\""+ConstantesJornada.JORNADA_COMPLETA.darValor()+"\","
                + "\""+AgendaEntity.DiaSemana.SABADO.darValor()+"\":\""+ConstantesJornada.JORNADA_MANANA_NOCHE.darValor()+"\","
                + "\""+AgendaEntity.DiaSemana.DOMINGO.darValor()+"\":\""+ConstantesJornada.JORNADA_TARDE.darValor()+"\""
                +"}";

            agenda.setFechasNoDisponibles(fechasNoLaborales);

            ProveedorEntity proveedor = factory.manufacturePojo(ProveedorEntity.class);
            utx.begin();
            em.persist(proveedor);
            utx.commit();
            agendaLogic.updateAgenda(agenda);

        } catch (BusinessLogicException ex) {
            Logger.getLogger(AgendaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
            Assert.fail("Deberia actualizar la agenda, "+ex.getMessage());
        } catch (NotSupportedException | SystemException | RollbackException | HeuristicMixedException | HeuristicRollbackException | SecurityException | IllegalStateException ex) {
            Logger.getLogger(AgendaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    @Test
    public void actualizarAgendaTest()
    {
        try {
            AgendaEntity agenda = agendaLogic.getAgenda(data.get(0).getId());
        Date dia = new Date();
        Calendar cal=Calendar.getInstance();
        cal.setTime(dia);
        cal.add(Calendar.DATE, 10);
        dia=cal.getTime();
        agenda.setFechaPenitencia(dia);

        String fechasNoLaborales=
                "{"
                + "\""+AgendaEntity.DiaSemana.LUNES.darValor()+"\":\""+ConstantesJornada.JORNADA_COMPLETA.darValor()+"\","
                + "\""+AgendaEntity.DiaSemana.MARTES.darValor()+"\":\""+ConstantesJornada.NINGUNA.darValor()+"\","
                + "\""+AgendaEntity.DiaSemana.MIERCOLES.darValor()+"\":\""+ConstantesJornada.JORNADA_COMPLETA.darValor()+"\","
                + "\""+AgendaEntity.DiaSemana.JUEVES.darValor()+"\":\""+ConstantesJornada.NINGUNA.darValor()+"\","
                + "\""+AgendaEntity.DiaSemana.VIERNES.darValor()+"\":\""+ConstantesJornada.JORNADA_COMPLETA.darValor()+"\","
                + "\""+AgendaEntity.DiaSemana.SABADO.darValor()+"\":\""+ConstantesJornada.JORNADA_MANANA_NOCHE.darValor()+"\","
                + "\""+AgendaEntity.DiaSemana.DOMINGO.darValor()+"\":\""+ConstantesJornada.JORNADA_TARDE.darValor()+"\""
                +"}";

            agenda.setFechasNoDisponibles(fechasNoLaborales);

            ProveedorEntity proveedor = factory.manufacturePojo(ProveedorEntity.class);
            utx.begin();
            em.persist(proveedor);
            utx.commit();
            agendaLogic.updateAgenda(agenda);

        } catch (BusinessLogicException ex) {
            Logger.getLogger(AgendaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
            Assert.fail("Deberia actualizar la agenda, "+ex.getMessage());
        } catch (NotSupportedException ex) {
            Logger.getLogger(AgendaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SystemException ex) {
            Logger.getLogger(AgendaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
        } catch (RollbackException ex) {
            Logger.getLogger(AgendaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
        } catch (HeuristicMixedException ex) {
            Logger.getLogger(AgendaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
        } catch (HeuristicRollbackException ex) {
            Logger.getLogger(AgendaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SecurityException ex) {
            Logger.getLogger(AgendaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalStateException ex) {
            Logger.getLogger(AgendaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

Merge Catch [catch(NotSupportedException ex), catch(SystemException ex), catch(RollbackException ex), catch(HeuristicMixedException ex), catch(HeuristicRollbackException ex), catch(SecurityException ex), catch(IllegalStateException ex)] to catch(NotSupportedException|SystemException|RollbackException|HeuristicMixedException|HeuristicRollbackException|SecurityException|IllegalStateException ex) in method public actualizarAgendaTest() : void from class logic.AgendaLogicTest


    @Test
    public void crearFechaTest()
    {
        //Fecha valida
        try {

            FechaEntity fechaValida = factory.manufacturePojo(FechaEntity.class);
            //ProveedorEntity proveedor =factory.manufacturePojo(ProveedorEntity.class);
            //em.persist(proveedor);
            AgendaEntity agenda = factory.manufacturePojo(AgendaEntity.class);
            //agenda.setProveeedor(proveedor);
            utx.begin();
            em.persist(agenda);
            utx.commit();
            fechaValida.setAgenda(agenda);
            Date dia = new Date();
            Calendar cal=Calendar.getInstance();
            cal.setTime(dia);
            cal.add(Calendar.DATE, 15);
            dia=cal.getTime();

            fechaValida.setDia(dia);

            fechaValida.setJornada(ConstantesJornada.JORNADA_COMPLETA.darValor());
            ArrayList<EventoEntity> eventos = new ArrayList<>();
            EventoEntity evento=factory.manufacturePojo(EventoEntity.class);
            utx.begin();
            em.persist(evento);
            utx.commit();
            eventos.add(evento);
            fechaValida.setEventos(eventos);
            fechaLogic.createFecha(agenda.getId(), fechaValida);
        } catch (BusinessLogicException e) {

            Assert.fail("Deberia crear la fecha, "+e.getMessage());
        } catch (NotSupportedException | SystemException | RollbackException | HeuristicMixedException | HeuristicRollbackException | SecurityException | IllegalStateException ex) {
            Logger.getLogger(FechaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @Test
    public void crearFechaTest()
    {
        //Fecha valida
        try {

            FechaEntity fechaValida = factory.manufacturePojo(FechaEntity.class);
            //ProveedorEntity proveedor =factory.manufacturePojo(ProveedorEntity.class);
            //em.persist(proveedor);
            AgendaEntity agenda = factory.manufacturePojo(AgendaEntity.class);
            //agenda.setProveeedor(proveedor);
            utx.begin();
            em.persist(agenda);
            utx.commit();
            fechaValida.setAgenda(agenda);
            Date dia = new Date();
            Calendar cal=Calendar.getInstance();
            cal.setTime(dia);
            cal.add(Calendar.DATE, 15);
            dia=cal.getTime();

            fechaValida.setDia(dia);

            fechaValida.setJornada(ConstantesJornada.JORNADA_COMPLETA.darValor());
            ArrayList<EventoEntity> eventos = new ArrayList<>();
            EventoEntity evento=factory.manufacturePojo(EventoEntity.class);
            utx.begin();
            em.persist(evento);
            utx.commit();
            eventos.add(evento);
            fechaValida.setEventos(eventos);
            fechaLogic.createFecha(agenda.getId(), fechaValida);
        } catch (BusinessLogicException e) {

            Assert.fail("Deberia crear la fecha, "+e.getMessage());
        } catch (NotSupportedException ex) {
            Logger.getLogger(FechaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SystemException ex) {
            Logger.getLogger(FechaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
        } catch (RollbackException ex) {
            Logger.getLogger(FechaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
        } catch (HeuristicMixedException ex) {
            Logger.getLogger(FechaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
        } catch (HeuristicRollbackException ex) {
            Logger.getLogger(FechaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SecurityException ex) {
            Logger.getLogger(FechaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalStateException ex) {
            Logger.getLogger(FechaLogicTest.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

Merge Catch [catch(NotSupportedException ex), catch(SystemException ex), catch(RollbackException ex), catch(HeuristicMixedException ex), catch(HeuristicRollbackException ex), catch(SecurityException ex), catch(IllegalStateException ex)] to catch(NotSupportedException|SystemException|RollbackException|HeuristicMixedException|HeuristicRollbackException|SecurityException|IllegalStateException ex) in method public crearFechaTest() : void from class logic.FechaLogicTest


  public DayTwo() {
    try {
      file = Files.readAllLines(Path.of("src/main/java/DayTwo.txt"));
    } catch (IOException e) {
      e.printStackTrace();
    }
    rounds = new ArrayList<>();
    for (String line : file) {
      rounds.add(line.split(" "));
    }

    System.out.println("Part one: " + partOne());
  }

  public DayTwo() {
    try {
      file = Files.readAllLines(Path.of("src/main/java/DayTwo.txt"));
    } catch (IOException e) {
      e.printStackTrace();
    }
    rounds = new ArrayList<String[]>();
    for (String line : file) {
      rounds.add(line.split(" "));
    }

    System.out.println("Part one: " + partOne());
  }

Replace Generic With Diamond ArrayList<String[]> with ArrayList<> in method public DayTwo() from class DayTwo


    public static void insertFromFile(String fileName) {
        try (BufferedReader reader = new BufferedReader(new FileReader(fileName))) {
            String line;
            Word currentWord = null;
            Meaning currentMeaning = null;
            StringBuilder descriptionBuilder = new StringBuilder();

            while ((line = reader.readLine()) != null) {
                line = line.trim();

                if (line.startsWith("@")) {
                    // Xử lý kết thúc của Word hiện tại
                    if (currentMeaning != null && descriptionBuilder.length() > 0) {
                        currentMeaning.setDescription(descriptionBuilder.toString().trim());
                        descriptionBuilder.setLength(0);
                    }
                    currentMeaning = null;

                    // Tạo Word mới
                    String[] parts = line.split(" /");
                    if (parts.length < 2) {
                        System.out.println("Dữ liệu không đúng định dạng tại dòng: " + line);
                        continue;
                    }
                    String word = parts[0].substring(1).trim();
                    String pronunciation = "/" + parts[1].trim();
                    currentWord = new Word(word, pronunciation);
                    dictionary.addWord(currentWord);
                } else if (currentWord != null && line.startsWith("*")) {
                    // Kết thúc mô tả Meaning hiện tại
                    if (currentMeaning != null) {
                        currentMeaning.setDescription(descriptionBuilder.toString().trim());
                        descriptionBuilder.setLength(0);
                    }

                    // Tạo Meaning mới
                    String partOfSpeech = line.substring(1).trim();
                    currentMeaning = new Meaning(partOfSpeech, "");
                    currentWord.addMeaning(currentMeaning);
                } else if (currentMeaning != null) {
                    // Thêm dữ liệu vào mô tả
                    descriptionBuilder.append(line).append(" ");
                }
            }

            // Xử lý mô tả cuối cùng
            if (currentMeaning != null && descriptionBuilder.length() > 0) {
                currentMeaning.setDescription(descriptionBuilder.toString().trim());
            }

        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void insertFromFile(String fileName) {
        HashSet<Word> wordSet = new HashSet<>();

        try {
            BufferedReader br = new BufferedReader(new FileReader(fileName));

            String line;
            while ((line = br.readLine()) != null) {
                String[] parts = line.split("\t");
                if (parts.length == 3) {  // Thay đổi từ 2 thành 3
                    String word_target = parts[0];
                    String word_explain = parts[2];
                    String pronunciation = parts[1];  // Thêm pronunciation từ file vào

                    Word newWord = new Word(word_target, pronunciation, word_explain);
                    //newWord.setPronunciation(pronunciation);

                    wordSet.add(newWord);
                }
            }

            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

        for (Word word : wordSet) {
            dictionary.addWord(word);
        }
    }

Try With Resources try(BufferedReader reader=new BufferedReader(new FileReader(fileName))) in method public insertFromFile(fileName String) : void from class DictionaryManagement


    public MotelRoom getMotelRoomById(int id) {
        MotelRoom room = null;
        String query = "SELECT mr.*, cr.descriptions as category, a.fullname, a.phone, m.detail_address, m.ward, m.district, m.city, m.province " +
                "FROM motel_room mr " +
                "JOIN category_room cr ON mr.category_room_id = cr.category_room_id " +
                "JOIN accounts a ON mr.account_id = a.account_id " +
                "JOIN motels m ON mr.motel_id = m.motel_id " +
                "WHERE mr.motel_room_id = ?";
        try (PreparedStatement ps = connection.prepareStatement(query)) {
            ps.setInt(1, id);
            ResultSet rs = ps.executeQuery();
            if (rs.next()) {
                room = new MotelRoom();
                room.setMotelRoomId(rs.getInt("motel_room_id"));
                room.setDescription(rs.getString("descriptions"));
                room.setLength(rs.getDouble("length"));
                room.setWidth(rs.getDouble("width"));
                room.setRoomPrice(rs.getDouble("room_price"));
                room.setElectricityPrice(rs.getDouble("electricity_price"));
                room.setWaterPrice(rs.getDouble("water_price"));
                room.setWifiPrice(rs.getDouble("wifi_price"));
                room.setAccountFullname(rs.getString("fullname"));
                room.setAccountPhone(rs.getString("phone"));
                room.setDetailAddress(rs.getString("detail_address"));
                room.setWard(rs.getString("ward"));
                room.setDistrict(rs.getString("district"));
                room.setCity(rs.getString("city"));
                room.setProvince(rs.getString("province"));
                room.setCategory(rs.getString("category"));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return room;
    }

    public MotelRoom getMotelRoomById(int roomId) {
        String query = "SELECT mr.*, a.fullname, a.phone, m.detail_address, m.ward, m.district, m.city, m.province " +
                "FROM motel_room mr " +
                "JOIN accounts a ON mr.account_id = a.account_id " +
                "JOIN motels m ON mr.motel_id = m.motel_id " +
                "WHERE mr.motel_room_id = ?";
        try {
            PreparedStatement ps = connection.prepareStatement(query);
            ps.setInt(1, roomId);
            ResultSet rs = ps.executeQuery();
            if (rs.next()) {
                MotelRoom room = new MotelRoom();
                room.setMotelRoomId(rs.getInt("motel_room_id"));
                room.setDescription(rs.getString("descriptions"));
                room.setLength(rs.getDouble("length"));
                room.setWidth(rs.getDouble("width"));
                room.setRoomPrice(rs.getDouble("room_price"));
                room.setElectricityPrice(rs.getDouble("electricity_price"));
                room.setWaterPrice(rs.getDouble("water_price"));
                room.setWifiPrice(rs.getDouble("wifi_price"));
                room.setDetailAddress(rs.getString("detail_address"));
                room.setWard(rs.getString("ward"));
                room.setDistrict(rs.getString("district"));
                room.setCity(rs.getString("city"));
                room.setProvince(rs.getString("province"));
                room.setCategoryRoomId(rs.getInt("category_room_id"));
                room.setMotelId(rs.getInt("motel_id"));
                room.setRoomStatus(rs.getBoolean("room_status"));
                room.setAccountId(rs.getInt("account_id"));
                room.setAccountFullname(rs.getString("fullname"));
                room.setAccountPhone(rs.getString("phone"));
                room.setImage(getImageByRoomId(roomId));
                return room;
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }

Try With Resources try(PreparedStatement ps=connection.prepareStatement(query)) in method public getMotelRoomById(id int) : MotelRoom from class dao.MotelRoomDAO


    public MotelRoom getMotelRoomById(int id) {
        MotelRoom room = null;
        String query = "SELECT mr.*, cr.descriptions as category, a.fullname, a.phone, m.detail_address, m.ward, m.district, m.city, m.province " +
                "FROM motel_room mr " +
                "JOIN category_room cr ON mr.category_room_id = cr.category_room_id " +
                "JOIN accounts a ON mr.account_id = a.account_id " +
                "JOIN motels m ON mr.motel_id = m.motel_id " +
                "WHERE mr.motel_room_id = ?";
        try (Connection con = DBcontext.getConnection();
             PreparedStatement ps = con.prepareStatement(query)) {
            ps.setInt(1, id);
            ResultSet rs = ps.executeQuery();
            if (rs.next()) {
                room = new MotelRoom();
                room.setMotelRoomId(rs.getInt("motel_room_id"));
                room.setDescription(rs.getString("descriptions"));
                room.setLength(rs.getDouble("length"));
                room.setWidth(rs.getDouble("width"));
                room.setRoomPrice(rs.getDouble("room_price"));
                room.setElectricityPrice(rs.getDouble("electricity_price"));
                room.setWaterPrice(rs.getDouble("water_price"));
                room.setWifiPrice(rs.getDouble("wifi_price"));
                room.setAccountFullname(rs.getString("fullname"));
                room.setAccountPhone(rs.getString("phone"));
                room.setDetailAddress(rs.getString("detail_address"));
                room.setWard(rs.getString("ward"));
                room.setDistrict(rs.getString("district"));
                room.setCity(rs.getString("city"));
                room.setProvince(rs.getString("province"));
                room.setCategory(rs.getString("category"));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return room;
    }

Try With Resources try(Connection con=DBcontext.getConnection(); PreparedStatement ps=con.prepareStatement(query)) in method public getMotelRoomById(id int) : MotelRoom from class dao.MotelRoomDAO


    public MotelRoom getMotelRoomById(int roomId) throws SQLException {
        String query = "SELECT mr.*, a.fullname, a.phone, m.detail_address, m.ward, m.district, m.province " +
                "FROM motel_room mr " +
                "JOIN accounts a ON mr.account_id = a.account_id " +
                "JOIN motels m ON mr.motel_id = m.motel_id " +
                "WHERE mr.motel_room_id = ?";
        try (PreparedStatement ps = connection.prepareStatement(query)) {
            ps.setInt(1, roomId);
            try (ResultSet rs = ps.executeQuery()) {
                if (rs.next()) {
                    MotelRoom room = new MotelRoom();
                    room.setMotelRoomId(rs.getInt("motel_room_id"));
                    room.setDescription(rs.getString("descriptions"));
                    room.setLength(rs.getDouble("length"));
                    room.setWidth(rs.getDouble("width"));
                    room.setRoomPrice(rs.getDouble("room_price"));
                    room.setElectricityPrice(rs.getDouble("electricity_price"));
                    room.setWaterPrice(rs.getDouble("water_price"));
                    room.setWifiPrice(rs.getDouble("wifi_price"));
                    room.setDetailAddress(rs.getString("detail_address"));
                    room.setWard(rs.getString("ward"));
                    room.setDistrict(rs.getString("district"));
                    room.setProvince(rs.getString("province"));
                    room.setCategoryRoomId(rs.getInt("category_room_id"));
                    room.setMotelId(rs.getInt("motel_id"));
                    room.setRoomStatus(rs.getBoolean("room_status"));
                    room.setAccountId(rs.getInt("account_id"));
                    room.setAccountFullname(rs.getString("fullname"));
                    room.setAccountPhone(rs.getString("phone"));
                    room.setImage(getImageByRoomId(roomId));
                    return room;
                }
            }
        } catch (SQLException e) {
            e.printStackTrace();
            throw e;
        }
        return null;
    }

Try With Resources try(ResultSet rs=ps.executeQuery()) in method public getMotelRoomById(roomId int) : MotelRoom from class dao.MotelRoomDAO


    private void receiveFile(String filePath, int size){
        byte[] buffer = new byte[1024];

        try(FileOutputStream fileOutputStream = new FileOutputStream(filePath);
            InputStream fileInputStream = clientSocket.getInputStream()) {
            int bytesRead;
            //while ((bytesRead = fileInputStream.read(buffer)) != -1) {
            while(size > 0 && (bytesRead = fileInputStream.read(buffer, 0, Math.min(buffer.length, size))) != -1) {
                fileOutputStream.write(buffer, 0, bytesRead);
                size -= bytesRead;
            }

            System.out.println("File uploaded: " + filePath);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private void receiveFile(String filePath){
        try{
            // Đọc dữ liệu tệp
            InputStream fileInputStream = clientSocket.getInputStream();
            byte[] buffer = new byte[1024];
            int bytesRead;
            FileOutputStream fileOutputStream = new FileOutputStream(filePath);

            while ((bytesRead = fileInputStream.read(buffer)) != -1) {
                fileOutputStream.write(buffer, 0, bytesRead);
            }

            fileOutputStream.close();

        } catch (IOException e) {
            e.printStackTrace();
        }
    }

Try With Resources try(FileOutputStream fileOutputStream=new FileOutputStream(filePath); InputStream fileInputStream=clientSocket.getInputStream()) in method private receiveFile(filePath String, size int) : void from class services.server.ClientHandler


    public List<File> getAllFile(int folderId) {
        try(Session session = HibernateUtil.getSessionFactory().openSession()) {
            //print session
            System.out.println("session: " + session);

            return session.createQuery("select f from File f where f.folderId = :folderId", File.class)
                    .setParameter("folderId", folderId)
                    .list();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public List<File> getAllFile(int folderId) {
        try {
            //print session
            System.out.println("session: " + session);

            return session.createQuery("select f from File f where f.folderId = :folderId", File.class)
                    .setParameter("folderId", folderId)
                    .list();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

Try With Resources try(Session session=HibernateUtil.getSessionFactory().openSession()) in method public getAllFile(folderId int) : List<File> from class services.server.user.FileService


    public File getFileById(int id) {
        try(Session session = HibernateUtil.getSessionFactory().openSession()) {
            return session.find(File.class, id);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public File getFileById(int id) {
        try {
            return session.find(File.class, id);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

Try With Resources try(Session session=HibernateUtil.getSessionFactory().openSession()) in method public getFileById(id int) : File from class services.server.user.FileService


    public boolean addFile(File file) {
        Transaction transaction = null;
        try(Session session = HibernateUtil.getSessionFactory().openSession()) {
            transaction = session.beginTransaction();
            session.persist(file);
            transaction.commit();
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    public boolean addFile(File file) {
        Transaction transaction = null;
        try {
            transaction = session.beginTransaction();
            session.persist(file);
            transaction.commit();
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

Try With Resources try(Session session=HibernateUtil.getSessionFactory().openSession()) in method public addFile(file File) : boolean from class services.server.user.FileService


    public boolean updateFile(File file) {
        Transaction transaction = null;
        try (Session session = HibernateUtil.getSessionFactory().openSession()){
            transaction = session.beginTransaction();
            session.merge(file);
            transaction.commit();
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    public boolean updateFile(File file) {
        Transaction transaction = null;
        try {
            transaction = session.beginTransaction();
            session.merge(file);
            transaction.commit();
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

Try With Resources try(Session session=HibernateUtil.getSessionFactory().openSession()) in method public updateFile(file File) : boolean from class services.server.user.FileService


    public boolean deleteFile(int id) {
        Transaction transaction = null;
        try (Session session = HibernateUtil.getSessionFactory().openSession()){
            transaction = session.beginTransaction();
            File file = session.find(File.class, id);
            session.remove(file);
            transaction.commit();
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    public boolean deleteFile(int id) {
        Transaction transaction = null;
        try {
            transaction = session.beginTransaction();
            File file = session.find(File.class, id);
            session.remove(file);
            transaction.commit();
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

Try With Resources try(Session session=HibernateUtil.getSessionFactory().openSession()) in method public deleteFile(id int) : boolean from class services.server.user.FileService


    public List<File> getFilesByOwnerId(int userId) {
        try (Session session = HibernateUtil.getSessionFactory().openSession()){
            return session.createQuery("select f from File f where f.ownerId = :userId", File.class)
                    .setParameter("userId", userId)
                    .list();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public List<File> getFilesByOwnerId(int userId) {
        try {
            return session.createQuery("select f from File f where f.ownerId = :userId", File.class)
                    .setParameter("userId", userId)
                    .list();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

Try With Resources try(Session session=HibernateUtil.getSessionFactory().openSession()) in method public getFilesByOwnerId(userId int) : List<File> from class services.server.user.FileService


    public List<File> getFilesByFolderId(int folderId) {
        try(Session session = HibernateUtil.getSessionFactory().openSession()) {
            return session.createQuery("select f from File f where f.folderId = :folderId", File.class)
                    .setParameter("folderId", folderId)
                    .list();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public List<File> getFilesByFolderId(int folderId) {
        try {
            return session.createQuery("select f from File f where f.folderId = :folderId", File.class)
                    .setParameter("folderId", folderId)
                    .list();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

Try With Resources try(Session session=HibernateUtil.getSessionFactory().openSession()) in method public getFilesByFolderId(folderId int) : List<File> from class services.server.user.FileService


    public List<File> getFilesByType(int type_id) {
        try(Session session = HibernateUtil.getSessionFactory().openSession()) {
            return session.createQuery("select f from File f where f.typeId = :type_id", File.class)
                    .setParameter("type_id", type_id)
                    .list();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public List<File> getFilesByType(int type_id) {
        try {
            return session.createQuery("select f from File f where f.typeId = :type_id", File.class)
                    .setParameter("type_id", type_id)
                    .list();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

Try With Resources try(Session session=HibernateUtil.getSessionFactory().openSession()) in method public getFilesByType(type_id int) : List<File> from class services.server.user.FileService


    public List<Folder> getAllFolder() {
        try(Session session = HibernateUtil.getSessionFactory().openSession()) {
            return session.createQuery("select fd from Folder fd", Folder.class).list();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public List<Folder> getAllFolder() {
        try {
            return session.createQuery("select fd from Folder fd", Folder.class).list();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

Try With Resources try(Session session=HibernateUtil.getSessionFactory().openSession()) in method public getAllFolder() : List<Folder> from class services.server.user.FolderService


    public Folder getFolderById(int id) {
        try(Session session = HibernateUtil.getSessionFactory().openSession()) {
            return session.find(Folder.class, id);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public Folder getFolderById(int id) {
        try {
            return session.find(Folder.class, id);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

Try With Resources try(Session session=HibernateUtil.getSessionFactory().openSession()) in method public getFolderById(id int) : Folder from class services.server.user.FolderService


    public List<Folder> getFoldersByParentId(int id) {
        try(Session session = HibernateUtil.getSessionFactory().openSession()) {
            return session.createQuery("select fd from Folder fd where fd.parentId = :id", Folder.class).setParameter("id", id).list();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public List<Folder> getFoldersByParentId(int id) {
        try {
            return session.createQuery("select fd from Folder fd where fd.parentId = :id", Folder.class).setParameter("id", id).list();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

Try With Resources try(Session session=HibernateUtil.getSessionFactory().openSession()) in method public getFoldersByParentId(id int) : List<Folder> from class services.server.user.FolderService


    public List<Folder> getFoldersByOwnerId(int id) {
        try(Session session = HibernateUtil.getSessionFactory().openSession()) {
            return session.createQuery("select fd from Folder fd where fd.ownerId = :id", Folder.class).setParameter("id", id).list();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public List<Folder> getFoldersByOwnerId(int id) {
        try {
            return session.createQuery("select fd from Folder fd where fd.ownerId = :id", Folder.class).setParameter("id", id).list();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

Try With Resources try(Session session=HibernateUtil.getSessionFactory().openSession()) in method public getFoldersByOwnerId(id int) : List<Folder> from class services.server.user.FolderService


    public long getSizeOfFolder(int id) {
        try(Session session = HibernateUtil.getSessionFactory().openSession()) {
            return session.createQuery("select sum(f.size) from File f where f.folderId = :id", Long.class).setParameter("id", id).getSingleResult();
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
        }
    }

    public long getSizeOfFolder(int id) {
        try {
            return session.createQuery("select sum(f.size) from File f where f.folderId = :id", Long.class).setParameter("id", id).getSingleResult();
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
        }
    }

Try With Resources try(Session session=HibernateUtil.getSessionFactory().openSession()) in method public getSizeOfFolder(id int) : long from class services.server.user.FolderService


    public int getNumberItemOfFolder(int id) {
        try(Session session = HibernateUtil.getSessionFactory().openSession()) {
            assert session != null;
            Query<Integer> countFile = session.createQuery("select count(*) from File where folderId = :id", Integer.class).setParameter("id", id);
            Query<Integer> countFolder = session.createQuery("select count(*) from Folder where parentId = :id", Integer.class).setParameter("id", id);
            return countFile.getSingleResult() + countFolder.getSingleResult();
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
        }
    }

    public int getNumberItemOfFolder(int id) {
        try {
            assert session != null;
            Query<Integer> countFile = session.createQuery("select count(*) from File where folderId = :id", Integer.class).setParameter("id", id);
            Query<Integer> countFolder = session.createQuery("select count(*) from Folder where parentId = :id", Integer.class).setParameter("id", id);
            return countFile.getSingleResult() + countFolder.getSingleResult();
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
        }
    }

Try With Resources try(Session session=HibernateUtil.getSessionFactory().openSession()) in method public getNumberItemOfFolder(id int) : int from class services.server.user.FolderService


    public Pair<Date, Integer> getLastModifiedInfo(int id) {
        try(Session session = HibernateUtil.getSessionFactory().openSession()) {
            Integer updatedBy = session.createQuery("select f.updatedBy from File f where f.folderId = :id order by f.updatedAt desc ", Integer.class)
                    .setParameter("id", id)
                    .setMaxResults(1)
                    .uniqueResult();
            Date dateOfFiles = session.createQuery("select max(f.updatedAt) from File f where f.folderId = :id", Date.class).setParameter("id", id).getSingleResult();

            List<Folder> folderList = session.createQuery("select fd from Folder fd where fd.parentId = :id", Folder.class).setParameter("id", id).list();
            Integer updatedByFolder = null;
            Date dateOfFolders = null;
            for (Folder folder : folderList) {
                Pair<Date, Integer> updatedFolderInfo = getLastModifiedInfo(folder.getId());
                if (updatedFolderInfo == null || updatedFolderInfo.getKey() == null || updatedFolderInfo.getValue() == null) continue;
                if (dateOfFolders == null || dateOfFolders.compareTo(updatedFolderInfo.getKey()) < 0) {
                    dateOfFolders = updatedFolderInfo.getKey();
                    updatedByFolder = updatedFolderInfo.getValue();
                }
            }

            if (dateOfFiles == null) {
                return new Pair<>(dateOfFolders, updatedByFolder);
            } else if (dateOfFolders == null) {
                return new Pair<>(dateOfFiles, updatedBy);
            } else {
                return dateOfFiles.compareTo(dateOfFolders) > 0 ? new Pair<>(dateOfFiles, updatedBy) : new Pair<>(dateOfFolders, updatedByFolder);
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public Pair<Date, Integer> getLastModifiedInfo(int id) {
        try {
            Integer updatedBy = session.createQuery("select f.updatedBy from File f where f.folderId = :id order by f.updatedAt desc ", Integer.class)
                    .setParameter("id", id)
                    .setMaxResults(1)
                    .uniqueResult();
            Date dateOfFiles = session.createQuery("select max(f.updatedAt) from File f where f.folderId = :id", Date.class).setParameter("id", id).getSingleResult();

            List<Folder> folderList = session.createQuery("select fd from Folder fd where fd.parentId = :id", Folder.class).setParameter("id", id).list();
            Integer updatedByFolder = null;
            Date dateOfFolders = null;
            for (Folder folder : folderList) {
                Pair<Date, Integer> updatedFolderInfo = getLastModifiedInfo(folder.getId());
                if (updatedFolderInfo == null || updatedFolderInfo.getKey() == null || updatedFolderInfo.getValue() == null) continue;
                if (dateOfFolders == null || dateOfFolders.compareTo(updatedFolderInfo.getKey()) < 0) {
                    dateOfFolders = updatedFolderInfo.getKey();
                    updatedByFolder = updatedFolderInfo.getValue();
                }
            }

            if (dateOfFiles == null) {
                return new Pair<>(dateOfFolders, updatedByFolder);
            } else if (dateOfFolders == null) {
                return new Pair<>(dateOfFiles, updatedBy);
            } else {
                return dateOfFiles.compareTo(dateOfFolders) > 0 ? new Pair<>(dateOfFiles, updatedBy) : new Pair<>(dateOfFolders, updatedByFolder);
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

Try With Resources try(Session session=HibernateUtil.getSessionFactory().openSession()) in method public getLastModifiedInfo(id int) : Pair<Date,Integer> from class services.server.user.FolderService


    public List<User> getAllUser() {
        try(Session session = HibernateUtil.getSessionFactory().openSession()) {
            return session.createQuery("select u from User u", User.class).list();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public List<User> getAllUser() {
        try {
            return session.createQuery("select u from User u", User.class).list();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

Try With Resources try(Session session=HibernateUtil.getSessionFactory().openSession()) in method public getAllUser() : List<User> from class services.server.user.UserService


    public User getUserById(int id) {
        try(Session session = HibernateUtil.getSessionFactory().openSession()) {
            return session.find(User.class, id);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public User getUserById(int id) {
        try {
            return session.find(User.class, id);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

Try With Resources try(Session session=HibernateUtil.getSessionFactory().openSession()) in method public getUserById(id int) : User from class services.server.user.UserService


    public static void main(String[] args) {
        List<Person> people = new ArrayList<>();
        people.add(new Teacher("Pekka Mikkola", "Korsontie Street 1 03100 Vantaa", 1200));
        people.add(new Student("Olli", "Ida Albergintie Street 1 00400 Helsinki"));

        printDepartment(people);
    }

    public static void main(String[] args) {
        List<Person> people = new ArrayList<Person>();
        people.add(new Teacher("Pekka Mikkola", "Korsontie Street 1 03100 Vantaa", 1200));
        people.add(new Student("Olli", "Ida Albergintie Street 1 00400 Helsinki"));

        printDepartment(people);
    }

Replace Generic With Diamond ArrayList<Person> with ArrayList<> in method public main(args String[]) : void from class week4.labs.Main


    private Path getPath(PropertyWriter writer, JsonStreamContext sc) {
        LinkedList<PathElement> elements = new LinkedList<>();

        if (sc != null) {
            elements.add(new PathElement(writer.getName(), sc.getCurrentValue()));
            sc = sc.getParent();
        }

        while (sc != null) {
            if (sc.getCurrentName() != null) {
                elements.addFirst(new PathElement(sc.getCurrentName(), sc.getCurrentValue()));
            }
            sc = sc.getParent();
        }

        return new Path(elements);
    }

    private Path getPath(PropertyWriter writer, JsonStreamContext sc) {
        LinkedList<PathElement> elements = new LinkedList<PathElement>();

        if (sc != null) {
            elements.add(new PathElement(writer.getName(), sc.getCurrentValue()));
            sc = sc.getParent();
        }

        while (sc != null) {
            if (sc.getCurrentName() != null) {
                elements.addFirst(new PathElement(sc.getCurrentName(), sc.getCurrentValue()));
            }
            sc = sc.getParent();
        }

        return new Path(elements);
    }

Replace Generic With Diamond LinkedList<PathElement> with LinkedList<> in method private getPath(writer PropertyWriter, sc JsonStreamContext) : Path from class com.github.bohnman.squiggly.filter.SquigglyPropertyFilter


        public List<SquigglyNode> toSquigglyNodes(SquigglyNode parentNode) {
            if (names == null || names.isEmpty()) {
                throw new IllegalArgumentException("No Names specified");
            }

            List<SquigglyNode> nodes;

            if (names.size() == 1) {
                nodes = Collections.singletonList(toSquigglyNode(names.get(0), parentNode));
            } else {
                nodes = new ArrayList<>(names.size());

                for (String name : names) {
                    nodes.add(toSquigglyNode(name, parentNode));
                }
            }

            return nodes;
        }

        public List<SquigglyNode> toSquigglyNodes(SquigglyNode parentNode) {
            if (names == null || names.isEmpty()) {
                throw new IllegalArgumentException("No Names specified");
            }

            List<SquigglyNode> nodes;

            if (names.size() == 1) {
                nodes = Collections.singletonList(toSquigglyNode(names.get(0), parentNode));
            } else {
                nodes = new ArrayList<SquigglyNode>(names.size());

                for (String name : names) {
                    nodes.add(toSquigglyNode(name, parentNode));
                }
            }

            return nodes;
        }

Replace Generic With Diamond ArrayList<SquigglyNode> with ArrayList<> in method public toSquigglyNodes(parentNode SquigglyNode) : List<SquigglyNode> from class com.github.bohnman.squiggly.parser.SquigglyParser.MutableNode


        public SquigglyNode toSquigglyNode(String name, SquigglyNode parentNode) {
            SquigglyNode node;

            if (children == null || children.isEmpty()) {
                node = newSquigglyNode(name, parentNode, Collections.<SquigglyNode>emptyList());
            } else {
                List<SquigglyNode> childNodes = new ArrayList<>(children.size());
                node = newSquigglyNode(name, parentNode, childNodes);
                addSquigglyChildNodes(node, childNodes);
            }

            return node;

        }

        public SquigglyNode toSquigglyNode(String name, SquigglyNode parentNode) {
            SquigglyNode node;

            if (children == null || children.isEmpty()) {
                node = newSquigglyNode(name, parentNode, Collections.<SquigglyNode>emptyList());
            } else {
                List<SquigglyNode> childNodes = new ArrayList<SquigglyNode>(children.size());
                node = newSquigglyNode(name, parentNode, childNodes);
                addSquigglyChildNodes(node, childNodes);
            }

            return node;

        }

Replace Generic With Diamond ArrayList<SquigglyNode> with ArrayList<> in method public toSquigglyNode(name String, parentNode SquigglyNode) : SquigglyNode from class com.github.bohnman.squiggly.parser.SquigglyParser.MutableNode


        @SuppressWarnings("SameParameterValue")
        private List<SquigglyNode> getSquigglyChildNodes(SquigglyNode parentNode) {
            if (children == null || children.isEmpty()) {
                return Collections.emptyList();
            }

            List<SquigglyNode> childNodes = new ArrayList<>();
            addSquigglyChildNodes(parentNode, childNodes);

            return childNodes;
        }

        @SuppressWarnings("SameParameterValue")
        private List<SquigglyNode> getSquigglyChildNodes(SquigglyNode parentNode) {
            if (children == null || children.isEmpty()) {
                return Collections.emptyList();
            }

            List<SquigglyNode> childNodes = new ArrayList<SquigglyNode>();
            addSquigglyChildNodes(parentNode, childNodes);

            return childNodes;
        }

Replace Generic With Diamond ArrayList<SquigglyNode> with ArrayList<> in method private getSquigglyChildNodes(parentNode SquigglyNode) : List<SquigglyNode> from class com.github.bohnman.squiggly.parser.SquigglyParser.MutableNode


        @SuppressWarnings("UnusedReturnValue")
        public MutableNode addName(String name) {
            if (names == null) {
                names = new ArrayList<>();
            }

            names.add(name);
            return this;
        }

        @SuppressWarnings("UnusedReturnValue")
        public MutableNode addName(String name) {
            if (names == null) {
                names = new ArrayList<String>();
            }

            names.add(name);
            return this;
        }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public addName(name String) : MutableNode from class com.github.bohnman.squiggly.parser.SquigglyParser.MutableNode


        public MutableNode newChild() {
            MutableNode child = new MutableNode()
                    .withParent(this);

            if (children == null) {
                children = new ArrayList<>();
            }

            children.add(child);

            return child;
        }

        public MutableNode newChild() {
            MutableNode child = new MutableNode()
                    .withParent(this);

            if (children == null) {
                children = new ArrayList<MutableNode>();
            }

            children.add(child);

            return child;
        }

Replace Generic With Diamond ArrayList<MutableNode> with ArrayList<> in method public newChild() : MutableNode from class com.github.bohnman.squiggly.parser.SquigglyParser.MutableNode


    private List<String> tokenize(String filter, String separators) {
        StringTokenizer tokenizer = new StringTokenizer(filter, separators, true);
        List<String> tokens = new ArrayList<>();

        while (tokenizer.hasMoreTokens()) {
            tokens.add(tokenizer.nextToken());
        }

        return tokens;
    }

    private List<String> tokenize(String filter, String separators) {
        StringTokenizer tokenizer = new StringTokenizer(filter, separators, true);
        List<String> tokens = new ArrayList<String>();

        while (tokenizer.hasMoreTokens()) {
            tokens.add(tokenizer.nextToken());
        }

        return tokens;
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private tokenize(filter String, separators String) : List<String> from class com.github.bohnman.squiggly.parser.SquigglyParser


    private Issue buildIssue() {
        Map<String, Object> properties = new HashMap<>();
        properties.put("email", "motherofdragons@got.com");
        properties.put("priority", "1");

        Issue issue = new Issue();
        issue.setId("ISSUE-1");
        issue.setIssueSummary("Dragons Need Fed");
        issue.setIssueDetails("I need my dragons fed pronto.");
        User assignee = new User("Jorah", "Mormont");
        issue.setAssignee(assignee);
        issue.setReporter(new User("Daenerys", "Targaryen"));
        issue.setActions(Arrays.asList(
                new IssueAction("COMMENT", "I'm going to let Daario get this one..", assignee),
                new IssueAction("CLOSE", "All set.", new User("Daario", "Naharis"))
        ));
        issue.setProperties(properties);
        return issue;
    }

    private Issue buildIssue() {
        Map<String, Object> properties = new HashMap<String, Object>();
        properties.put("email", "motherofdragons@got.com");
        properties.put("priority", "1");

        Issue issue = new Issue();
        issue.setId("ISSUE-1");
        issue.setIssueSummary("Dragons Need Fed");
        issue.setIssueDetails("I need my dragons fed pronto.");
        User assignee = new User("Jorah", "Mormont");
        issue.setAssignee(assignee);
        issue.setReporter(new User("Daenerys", "Targaryen"));
        issue.setActions(Arrays.asList(
                new IssueAction("COMMENT", "I'm going to let Daario get this one..", assignee),
                new IssueAction("CLOSE", "All set.", new User("Daario", "Naharis"))
        ));
        issue.setProperties(properties);
        return issue;
    }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method private buildIssue() : Issue from class com.github.bohnman.squiggly.filter.SquigglyPropertyFilterTests


    public static void readFile(HttpServletResponse response, String filePath) {
        File file = new File(filePath);
        if (!file.exists()) {
            return;
        }

        try (FileInputStream in = new FileInputStream(file);
             //TODO 注意资源一定要及时释放，不然会导致资源被一直占用，在更新头像时报错！
             OutputStream out = response.getOutputStream()) {//try-with-resources语句会自动关闭资源
            byte[] byteData = new byte[1024];
            int len;
            while ((len = in.read(byteData)) != -1) {
                out.write(byteData, 0, len);
            }
            out.flush();
        } catch (Exception e) {
            throw new BusinessException("文件读取异常");
        }
    }

    public static void readFile(HttpServletResponse response, String filePath) {
        OutputStream out = null;
        FileInputStream in = null;
        try {
            File file = new File(filePath);
            if (!file.exists()) {
                return;
            }
            in = new FileInputStream(file);
            byte[] byteData = new byte[1024];
            out = response.getOutputStream();
            int len = 0;
            while ((len = in.read(byteData)) != -1) {
                out.write(byteData, 0, len);
            }
            out.flush();
        } catch (Exception e) {
            throw new BusinessException("文件读取异常");
        }
    }

Try With Resources try(FileInputStream in=new FileInputStream(file); OutputStream out=response.getOutputStream()) in method public readFile(response HttpServletResponse, filePath String) : void from class com.netdisk.utils.FileTools


    public OrderMapRepo() {
        orderMap = new HashMap<>();
    }

    public OrderMapRepo() {
        orderMap = new HashMap<Integer,Order>();
    }

Replace Generic With Diamond HashMap<Integer,Order> with HashMap<> in method public OrderMapRepo() from class org.example.OrderMapRepo


    @Override
    public List<Order> getOrdertList() {
        return new ArrayList<>(orderMap.values());
    }

    @Override
    public List<Order> getOrdertList() {
        return new ArrayList<Order>(orderMap.values());
    }

Replace Generic With Diamond ArrayList<Order> with ArrayList<> in method public getOrdertList() : List<Order> from class org.example.OrderMapRepo


    public ProductRepo(List<Product> products) {
        this.products = new ArrayList<>(products);
    }

    public ProductRepo(List<Product> products) {
        this.products = new ArrayList<Product>(products);
    }

Replace Generic With Diamond ArrayList<Product> with ArrayList<> in method public ProductRepo(products List<Product>) from class org.example.ProductRepo


    public ProductRepo() {
        this.products = new ArrayList<>();
    }

    public ProductRepo() {
        this.products = new ArrayList<Product>();
    }

Replace Generic With Diamond ArrayList<Product> with ArrayList<> in method public ProductRepo() from class org.example.ProductRepo


    public static ArrayList<String> readCSVFile(File filePath) {
        ArrayList<String> output = new ArrayList<String>();
        try(BufferedReader reader = new BufferedReader(new FileReader(filePath))) {
            String line;
            while((line = reader.readLine()) != null)
                output.add(line);
        }
        catch(Exception e) {
            e.printStackTrace();
        }
        return output;
    }

    public static ArrayList<String> readCSVFile(File filePath) {
        ArrayList<String> output = new ArrayList<String>();
        try {
            BufferedReader reader = new BufferedReader(new FileReader(filePath));
            String line;
            while((line = reader.readLine()) != null)
                output.add(line);
            reader.close();
        }
        catch(Exception e) {
            e.printStackTrace();
        }
        return output;
    }

Try With Resources try(BufferedReader reader=new BufferedReader(new FileReader(filePath))) in method public readCSVFile(filePath File) : ArrayList<String> from class com.teriyake.vai.VaiUtil


    @Override
    public HandlerRegistration addOrientationChangeHandler(OrientationChangeHandler handler) {
        return addHandler(event -> {
            if (isEnabled()) {
                handler.onOrientationChange(event);
            }
        }, OrientationChangeEvent.TYPE);
    }

    @Override
    public HandlerRegistration addOrientationChangeHandler(OrientationChangeEvent.OrientationChangeHandler handler) {
        return addHandler(new OrientationChangeEvent.OrientationChangeHandler() {
            @Override
            public void onOrientationChange(OrientationChangeEvent event) {
                if (isEnabled()) {
                    handler.onOrientationChange(event);
                }
            }
        }, OrientationChangeEvent.TYPE);
    }

Replace Anonymous With Lambda gwt.material.design.client.base.MaterialWidget.addOrientationChangeHandler.addHandler.new OrientationChangeEvent.OrientationChangeHandler with event -> {if(isEnabled()){handler.onOrientationChange(event); in method public addOrientationChangeHandler(handler OrientationChangeHandler) : HandlerRegistration from class gwt.material.design.client.base.MaterialWidget


    @Override
    public HandlerRegistration addSelectionHandler(final SelectionHandler<Widget> handler) {
        return addHandler((SelectionHandler<Widget>)event -> {
            Widget widget = event.getSelectedItem();
            if (widget instanceof HasEnabled && ((HasEnabled) widget).isEnabled() && isEnabled()) {
                handler.onSelection(event);
            }
        }, SelectionEvent.getType());
    }

    @Override
    public HandlerRegistration addSelectionHandler(final SelectionHandler<Widget> handler) {
        return addHandler(new SelectionHandler<Widget>() {
            @Override
            public void onSelection(SelectionEvent<Widget> event) {
                Widget widget = event.getSelectedItem();
                if (widget instanceof HasEnabled) {
                    if (((HasEnabled) widget).isEnabled() && isEnabled()) {
                        handler.onSelection(event);
                    }
                }
            }
        }, SelectionEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialDropDown.addSelectionHandler.addHandler.new SelectionHandler<Widget> with event -> {Widget widget=event.getSelectedItem(); in method public addSelectionHandler(handler SelectionHandler<Widget>) : HandlerRegistration from class gwt.material.design.client.ui.MaterialDropDown


    /**
     * {@inheritDoc}
     */
    @Override
    public boolean validate(boolean show) {
        Boolean oldValid = valid;
        valid = true;
        if (errorHandler != null && !validators.isEmpty()) {
            List<EditorError> errors = new ArrayList<>();
            for (ValidatorWrapper<V> wrapper : validators) {
                Validator<V> validator = wrapper.getValidator();
                List<EditorError> result = validator.validate(inputWidget, inputWidget.getValue());
                if (result != null && !result.isEmpty()) {
                    errors.addAll(result);
                    valid = false;
                }
            }
            if (show) {
                if (errors.size() > 0) {
                    errorHandler.showErrors(errors);
                } else {
                    errorHandler.clearErrors();
                }
            }
        }
        if (valid != oldValid) {
            eventBus.fireEvent(new ValidationChangedEvent(valid));
        }
        return valid;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean validate(boolean show) {
        Boolean oldValid = valid;
        valid = true;
        if (errorHandler != null && !validators.isEmpty()) {
            List<EditorError> errors = new ArrayList<EditorError>();
            for (ValidatorWrapper<V> wrapper : validators) {
                Validator<V> validator = wrapper.getValidator();
                List<EditorError> result = validator.validate(inputWidget, inputWidget.getValue());
                if (result != null && !result.isEmpty()) {
                    errors.addAll(result);
                    valid = false;
                }
            }
            if (show) {
                if (errors.size() > 0) {
                    errorHandler.showErrors(errors);
                } else {
                    errorHandler.clearErrors();
                }
            }
        }
        if (valid != oldValid) {
            eventBus.fireEvent(new ValidationChangedEvent(valid));
        }
        return valid;
    }

Replace Generic With Diamond ArrayList<EditorError> with ArrayList<> in method public validate(show boolean) : boolean from class gwt.material.design.client.base.mixin.ValidatorMixin


  protected void ensureDomEventHandlers() {
    addClickHandler(event -> {
      // Checkboxes always toggle their value, no need to compare
      // with old value. Radio buttons are not so lucky, see
      // overrides in RadioButton
      ValueChangeEvent.fire(BaseCheckBox.this, getValue());
    });
  }

  protected void ensureDomEventHandlers() {
    addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        // Checkboxes always toggle their value, no need to compare
        // with old value. Radio buttons are not so lucky, see
        // overrides in RadioButton
        ValueChangeEvent.fire(BaseCheckBox.this, getValue());
      }
    });
  }

Replace Anonymous With Lambda gwt.material.design.client.base.BaseCheckBox.ensureDomEventHandlers.addClickHandler.new ClickHandler with event -> {ValueChangeEvent.fire(BaseCheckBox.this,getValue()); in method protected ensureDomEventHandlers() : void from class gwt.material.design.client.base.BaseCheckBox


    @Override
    public HandlerRegistration addCloseHandler(final CloseHandler<String> handler) {
        return addHandler((CloseHandler<String>) event -> handler.onClose(event), CloseEvent.getType());
    }

    @Override
    public HandlerRegistration addCloseHandler(final CloseHandler<String> handler) {
        return addHandler(new CloseHandler<String>() {
            @Override
            public void onClose(CloseEvent<String> event) {
                handler.onClose(event);
            }
        }, CloseEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialSearch.addCloseHandler.addHandler.new CloseHandler<String> with event -> handler.onClose(event) in method public addCloseHandler(handler CloseHandler<String>) : HandlerRegistration from class gwt.material.design.client.ui.MaterialSearch


    public void triggerAutoResize() {
        if(!valueBoxBase.isAttached()) {
            if (attachHandler == null) {
                attachHandler = valueBoxBase.addAttachHandler(event -> {
                    if(event.isAttached()) {
                        triggerAutoResize(valueBoxBase.getElement());
                    }
                });
            }
        } else {
            triggerAutoResize(valueBoxBase.getElement());
        }
    }

    public void triggerAutoResize() {
        if(!valueBoxBase.isAttached()) {
            if (attachHandler == null) {
                attachHandler = valueBoxBase.addAttachHandler(new Handler() {
                    @Override
                    public void onAttachOrDetach(AttachEvent event) {
                        if(event.isAttached()) {
                            triggerAutoResize(valueBoxBase.getElement());
                        }
                    }
                });
            }
        } else {
            triggerAutoResize(valueBoxBase.getElement());
        }
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialTextArea.triggerAutoResize.addAttachHandler.new Handler with event -> {if(event.isAttached()){triggerAutoResize(valueBoxBase.getElement()); in method public triggerAutoResize() : void from class gwt.material.design.client.ui.MaterialTextArea


    @Override
    public HandlerRegistration addDragEndHandler(DragEndHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) { handler.onDragEnd(event); }
        }, DragEndEvent.getType());
    }

    @Override
    public HandlerRegistration addDragEndHandler(final DragEndHandler handler) {
        return addBitlessDomHandler(new DragEndHandler() {
            @Override
            public void onDragEnd(DragEndEvent event) {
                if(isEnabled()){
                    handler.onDragEnd(event);
                }
            }
        }, DragEndEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialImage.addDragEndHandler.addBitlessDomHandler.new DragEndHandler with event -> {if(isEnabled()){handler.onDragEnd(event); in method public addDragEndHandler(handler DragEndHandler) : HandlerRegistration from class gwt.material.design.client.base.MaterialWidget


    @Override
    public HandlerRegistration addDragEnterHandler(DragEnterHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) { handler.onDragEnter(event); }
        }, DragEnterEvent.getType());
    }

    @Override
    public HandlerRegistration addDragEnterHandler(final DragEnterHandler handler) {
        return addBitlessDomHandler(new DragEnterHandler() {
            @Override
            public void onDragEnter(DragEnterEvent event) {
                if(isEnabled()){
                    handler.onDragEnter(event);
                }
            }
        }, DragEnterEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialImage.addDragEnterHandler.addBitlessDomHandler.new DragEnterHandler with event -> {if(isEnabled()){handler.onDragEnter(event); in method public addDragEnterHandler(handler DragEnterHandler) : HandlerRegistration from class gwt.material.design.client.base.MaterialWidget


    @Override
    public HandlerRegistration addDragHandler(DragHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) { handler.onDrag(event); }
        }, DragEvent.getType());
    }

    @Override
    public HandlerRegistration addDragHandler(final DragHandler handler) {
        return addBitlessDomHandler(new DragHandler() {
            @Override
            public void onDrag(DragEvent event) {
                if(isEnabled()){
                    handler.onDrag(event);
                }
            }
        }, DragEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialImage.addDragHandler.addBitlessDomHandler.new DragHandler with event -> {if(isEnabled()){handler.onDrag(event); in method public addDragHandler(handler DragHandler) : HandlerRegistration from class gwt.material.design.client.base.MaterialWidget


    @Override
    public HandlerRegistration addDragLeaveHandler(DragLeaveHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) { handler.onDragLeave(event); }
        }, DragLeaveEvent.getType());
    }

    @Override
    public HandlerRegistration addDragLeaveHandler(final DragLeaveHandler handler) {
        return addBitlessDomHandler(new DragLeaveHandler() {
            @Override
            public void onDragLeave(DragLeaveEvent event) {
                if(isEnabled()){
                    handler.onDragLeave(event);
                }
            }
        }, DragLeaveEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialImage.addDragLeaveHandler.addBitlessDomHandler.new DragLeaveHandler with event -> {if(isEnabled()){handler.onDragLeave(event); in method public addDragLeaveHandler(handler DragLeaveHandler) : HandlerRegistration from class gwt.material.design.client.base.MaterialWidget


    @Override
    public HandlerRegistration addDragOverHandler(DragOverHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) { handler.onDragOver(event); }
        }, DragOverEvent.getType());
    }

    @Override
    public HandlerRegistration addDragOverHandler(final DragOverHandler handler) {
        return addBitlessDomHandler(new DragOverHandler() {
            @Override
            public void onDragOver(DragOverEvent event) {
                if(isEnabled()){
                    handler.onDragOver(event);
                }
            }
        }, DragOverEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialImage.addDragOverHandler.addBitlessDomHandler.new DragOverHandler with event -> {if(isEnabled()){handler.onDragOver(event); in method public addDragOverHandler(handler DragOverHandler) : HandlerRegistration from class gwt.material.design.client.base.MaterialWidget


    @Override
    public HandlerRegistration addDragStartHandler(DragStartHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) { handler.onDragStart(event); }
        }, DragStartEvent.getType());
    }

    @Override
    public HandlerRegistration addDragStartHandler(final DragStartHandler handler) {
        return addBitlessDomHandler(new DragStartHandler() {
            @Override
            public void onDragStart(DragStartEvent event) {
                if(isEnabled()){
                    handler.onDragStart(event);
                }
            }
        }, DragStartEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialImage.addDragStartHandler.addBitlessDomHandler.new DragStartHandler with event -> {if(isEnabled()){handler.onDragStart(event); in method public addDragStartHandler(handler DragStartHandler) : HandlerRegistration from class gwt.material.design.client.base.MaterialWidget


    @Override
    public HandlerRegistration addDropHandler(DropHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) { handler.onDrop(event); }
        }, DropEvent.getType());
    }

    @Override
    public HandlerRegistration addDropHandler(final DropHandler handler) {
        return addBitlessDomHandler(new DropHandler() {
            @Override
            public void onDrop(DropEvent event) {
                if(isEnabled()){
                    handler.onDrop(event);
                }
            }
        }, DropEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialImage.addDropHandler.addBitlessDomHandler.new DropHandler with event -> {if(isEnabled()){handler.onDrop(event); in method public addDropHandler(handler DropHandler) : HandlerRegistration from class gwt.material.design.client.base.MaterialWidget


    @Override
    public HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) { handler.onTouchCancel(event); }
        }, TouchCancelEvent.getType());
    }

    @Override
    public HandlerRegistration addTouchCancelHandler(final TouchCancelHandler handler) {
        return addDomHandler(new TouchCancelHandler() {
            @Override
            public void onTouchCancel(TouchCancelEvent event) {
                if(isEnabled()){
                    handler.onTouchCancel(event);
                }
            }
        }, TouchCancelEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialImage.addTouchCancelHandler.addDomHandler.new TouchCancelHandler with event -> {if(isEnabled()){handler.onTouchCancel(event); in method public addTouchCancelHandler(handler TouchCancelHandler) : HandlerRegistration from class gwt.material.design.client.base.MaterialWidget


    @Override
    public HandlerRegistration addTouchEndHandler(TouchEndHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) { handler.onTouchEnd(event); }
        }, TouchEndEvent.getType());
    }

    @Override
    public HandlerRegistration addTouchEndHandler(final TouchEndHandler handler) {
        return addDomHandler(new TouchEndHandler() {
            @Override
            public void onTouchEnd(TouchEndEvent event) {
                if(isEnabled()){
                    handler.onTouchEnd(event);
                }
            }
        }, TouchEndEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialImage.addTouchEndHandler.addDomHandler.new TouchEndHandler with event -> {if(isEnabled()){handler.onTouchEnd(event); in method public addTouchEndHandler(handler TouchEndHandler) : HandlerRegistration from class gwt.material.design.client.base.MaterialWidget


    @Override
    public HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) { handler.onTouchMove(event); }
        }, TouchMoveEvent.getType());
    }

    @Override
    public HandlerRegistration addTouchMoveHandler(final TouchMoveHandler handler) {
        return addDomHandler(new TouchMoveHandler() {
            @Override
            public void onTouchMove(TouchMoveEvent event) {
                if(isEnabled()){
                    handler.onTouchMove(event);
                }
            }
        }, TouchMoveEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialImage.addTouchMoveHandler.addDomHandler.new TouchMoveHandler with event -> {if(isEnabled()){handler.onTouchMove(event); in method public addTouchMoveHandler(handler TouchMoveHandler) : HandlerRegistration from class gwt.material.design.client.base.MaterialWidget


    @Override
    public HandlerRegistration addTouchStartHandler(TouchStartHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) { handler.onTouchStart(event); }
        }, TouchStartEvent.getType());
    }

    @Override
    public HandlerRegistration addTouchStartHandler(final TouchStartHandler handler) {
        return addDomHandler(new TouchStartHandler() {
            @Override
            public void onTouchStart(TouchStartEvent event) {
                if(isEnabled()){
                    handler.onTouchStart(event);
                }
            }
        }, TouchStartEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialImage.addTouchStartHandler.addDomHandler.new TouchStartHandler with event -> {if(isEnabled()){handler.onTouchStart(event); in method public addTouchStartHandler(handler TouchStartHandler) : HandlerRegistration from class gwt.material.design.client.base.MaterialWidget


    @Override
    public HandlerRegistration addGestureChangeHandler(GestureChangeHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) { handler.onGestureChange(event); }
        }, GestureChangeEvent.getType());
    }

    @Override
    public HandlerRegistration addGestureChangeHandler(final GestureChangeHandler handler) {
        return addDomHandler(new GestureChangeHandler() {
            @Override
            public void onGestureChange(GestureChangeEvent event) {
                if(isEnabled()){
                    handler.onGestureChange(event);
                }
            }
        }, GestureChangeEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialImage.addGestureChangeHandler.addDomHandler.new GestureChangeHandler with event -> {if(isEnabled()){handler.onGestureChange(event); in method public addGestureChangeHandler(handler GestureChangeHandler) : HandlerRegistration from class gwt.material.design.client.base.MaterialWidget


    @Override
    public HandlerRegistration addGestureEndHandler(GestureEndHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) { handler.onGestureEnd(event); }
        }, GestureEndEvent.getType());
    }

    @Override
    public HandlerRegistration addGestureEndHandler(final GestureEndHandler handler) {
        return addDomHandler(new GestureEndHandler() {
            @Override
            public void onGestureEnd(GestureEndEvent event) {
                if(isEnabled()){
                    handler.onGestureEnd(event);
                }
            }
        }, GestureEndEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialImage.addGestureEndHandler.addDomHandler.new GestureEndHandler with event -> {if(isEnabled()){handler.onGestureEnd(event); in method public addGestureEndHandler(handler GestureEndHandler) : HandlerRegistration from class gwt.material.design.client.base.MaterialWidget


    @Override
    public HandlerRegistration addGestureStartHandler(GestureStartHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) { handler.onGestureStart(event); }
        }, GestureStartEvent.getType());
    }

    @Override
    public HandlerRegistration addGestureStartHandler(final GestureStartHandler handler) {
        return addDomHandler(new GestureStartHandler() {
            @Override
            public void onGestureStart(GestureStartEvent event) {
                if(isEnabled()){
                    handler.onGestureStart(event);
                }
            }
        }, GestureStartEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialImage.addGestureStartHandler.addDomHandler.new GestureStartHandler with event -> {if(isEnabled()){handler.onGestureStart(event); in method public addGestureStartHandler(handler GestureStartHandler) : HandlerRegistration from class gwt.material.design.client.base.MaterialWidget


    @Override
    public HandlerRegistration addClickHandler(final ClickHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()){
                handler.onClick(event);
            }
        }, ClickEvent.getType());
    }

    @Override
    public HandlerRegistration addClickHandler(final ClickHandler handler) {
        return addDomHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                if(isEnabled()){
                    handler.onClick(event);
                }
            }
        }, ClickEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.base.AbstractButton.addClickHandler.addDomHandler.new ClickHandler with event -> {if(isEnabled()){handler.onClick(event); in method public addClickHandler(handler ClickHandler) : HandlerRegistration from class gwt.material.design.client.base.AbstractButton


    @Override
    public HandlerRegistration addMouseDownHandler(final MouseDownHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()){
                handler.onMouseDown(event);
            }
        }, MouseDownEvent.getType());
    }

    @Override
    public HandlerRegistration addMouseDownHandler(final MouseDownHandler handler) {
        return addDomHandler(new MouseDownHandler() {
            @Override
            public void onMouseDown(MouseDownEvent event) {
                if(isEnabled()){
                    handler.onMouseDown(event);
                }
            }
        }, MouseDownEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.base.AbstractButton.addMouseDownHandler.addDomHandler.new MouseDownHandler with event -> {if(isEnabled()){handler.onMouseDown(event); in method public addMouseDownHandler(handler MouseDownHandler) : HandlerRegistration from class gwt.material.design.client.base.AbstractButton


    @Override
    public HandlerRegistration addMouseMoveHandler(final MouseMoveHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()){
                handler.onMouseMove(event);
            }
        }, MouseMoveEvent.getType());
    }

    @Override
    public HandlerRegistration addMouseMoveHandler(final MouseMoveHandler handler) {
        return addDomHandler(new MouseMoveHandler() {
            @Override
            public void onMouseMove(MouseMoveEvent event) {
                if(isEnabled()){
                    handler.onMouseMove(event);
                }
            }
        }, MouseMoveEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.base.AbstractButton.addMouseMoveHandler.addDomHandler.new MouseMoveHandler with event -> {if(isEnabled()){handler.onMouseMove(event); in method public addMouseMoveHandler(handler MouseMoveHandler) : HandlerRegistration from class gwt.material.design.client.base.AbstractButton


    @Override
    public HandlerRegistration addMouseOutHandler(final MouseOutHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) {
                handler.onMouseOut(event);
            }
        }, MouseOutEvent.getType());
    }

    @Override
    public HandlerRegistration addMouseOutHandler(final MouseOutHandler handler) {
        return addDomHandler(new MouseOutHandler() {
            @Override
            public void onMouseOut(MouseOutEvent event) {
                if(isEnabled()) {
                    handler.onMouseOut(event);
                }
            }
        }, MouseOutEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.base.AbstractButton.addMouseOutHandler.addDomHandler.new MouseOutHandler with event -> {if(isEnabled()){handler.onMouseOut(event); in method public addMouseOutHandler(handler MouseOutHandler) : HandlerRegistration from class gwt.material.design.client.base.AbstractButton


    @Override
    public HandlerRegistration addMouseOverHandler(final MouseOverHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) {
                handler.onMouseOver(event);
            }
        }, MouseOverEvent.getType());
    }

    @Override
    public HandlerRegistration addMouseOverHandler(final MouseOverHandler handler) {
        return addDomHandler(new MouseOverHandler() {
            @Override
            public void onMouseOver(MouseOverEvent event) {
                if(isEnabled()) {
                    handler.onMouseOver(event);
                }
            }
        }, MouseOverEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.base.AbstractButton.addMouseOverHandler.addDomHandler.new MouseOverHandler with event -> {if(isEnabled()){handler.onMouseOver(event); in method public addMouseOverHandler(handler MouseOverHandler) : HandlerRegistration from class gwt.material.design.client.base.AbstractButton


    @Override
    public HandlerRegistration addMouseUpHandler(final MouseUpHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) {
                handler.onMouseUp(event);
            }
        }, MouseUpEvent.getType());
    }

    @Override
    public HandlerRegistration addMouseUpHandler(final MouseUpHandler handler) {
        return addDomHandler(new MouseUpHandler() {
            @Override
            public void onMouseUp(MouseUpEvent event) {
                if(isEnabled()) {
                    handler.onMouseUp(event);
                }
            }
        }, MouseUpEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.base.AbstractButton.addMouseUpHandler.addDomHandler.new MouseUpHandler with event -> {if(isEnabled()){handler.onMouseUp(event); in method public addMouseUpHandler(handler MouseUpHandler) : HandlerRegistration from class gwt.material.design.client.base.AbstractButton


    @Override
    public HandlerRegistration addMouseWheelHandler(final MouseWheelHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) {
                handler.onMouseWheel(event);
            }
        }, MouseWheelEvent.getType());
    }

    @Override
    public HandlerRegistration addMouseWheelHandler(final MouseWheelHandler handler) {
        return addDomHandler(new MouseWheelHandler() {
            @Override
            public void onMouseWheel(MouseWheelEvent event) {
                if(isEnabled()) {
                    handler.onMouseWheel(event);
                }
            }
        }, MouseWheelEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.base.AbstractButton.addMouseWheelHandler.addDomHandler.new MouseWheelHandler with event -> {if(isEnabled()){handler.onMouseWheel(event); in method public addMouseWheelHandler(handler MouseWheelHandler) : HandlerRegistration from class gwt.material.design.client.base.AbstractButton


    @Override
    public HandlerRegistration addDoubleClickHandler(final DoubleClickHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()) {
                handler.onDoubleClick(event);
            }
        }, DoubleClickEvent.getType());
    }

    @Override
    public HandlerRegistration addDoubleClickHandler(final DoubleClickHandler handler) {
        return addDomHandler(new DoubleClickHandler() {
            @Override
            public void onDoubleClick(DoubleClickEvent event) {
                if(isEnabled()) {
                    handler.onDoubleClick(event);
                }
            }
        }, DoubleClickEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.base.AbstractButton.addDoubleClickHandler.addDomHandler.new DoubleClickHandler with event -> {if(isEnabled()){handler.onDoubleClick(event); in method public addDoubleClickHandler(handler DoubleClickHandler) : HandlerRegistration from class gwt.material.design.client.base.AbstractButton


    /**
     * Detect and apply waves, now or when the widget is attached.
     * @param widget target widget to ensure is attached first
     */
    public static void detectAndApply(Widget widget) {
        if(!widget.isAttached()) {
            widget.addAttachHandler(event -> {
                if(event.isAttached()) {
                    detectAndApply();
                }
            });
        } else {
            detectAndApply();
        }
    }

    /**
     * Detect and apply waves, now or when the widget is attached.
     * @param widget target widget to ensure is attached first
     */
    public static void detectAndApply(Widget widget) {
        if(!widget.isAttached()) {
            widget.addAttachHandler(new AttachEvent.Handler() {
                @Override
                public void onAttachOrDetach(AttachEvent event) {
                    if(event.isAttached()) {
                        detectAndApply();
                    }
                }
            });
        } else {
            detectAndApply();
        }
    }

Replace Anonymous With Lambda gwt.material.design.client.base.Waves.detectAndApply.addAttachHandler.new AttachEvent.Handler with event -> {if(event.isAttached()){detectAndApply(); in method public detectAndApply(widget Widget) : void from class gwt.material.design.client.base.Waves


    /**
     * Default error handler.
     *
     * @param widget the parent of this error handler.
     */
    public DefaultErrorHandler(Widget widget) {
        super();
        assert widget != null;
        this.inputWidget = widget;
        this.inputWidget.addAttachHandler(event -> {
            init();
        });
    }

    /**
     * Default error handler.
     *
     * @param widget the parent of this error handler.
     */
    public DefaultErrorHandler(Widget widget) {
        super();
        assert widget != null;
        this.inputWidget = widget;
        this.inputWidget.addAttachHandler(new Handler() {
            @Override
            public void onAttachOrDetach(AttachEvent event) {
                init();
            }
        });
    }

Replace Anonymous With Lambda gwt.material.design.client.base.error.DefaultErrorHandler.DefaultErrorHandler.addAttachHandler.new Handler with event -> {init(); in method public DefaultErrorHandler(widget Widget) from class gwt.material.design.client.base.error.DefaultErrorHandler


        @Override
        public void onAttachOrDetach(AttachEvent event) {
            if(registration != null) {
                registration.removeHandler();
            }
            registration = inputWidget.addBlurHandler(blurEvent -> {
                validate(isValidateOnBlur());
            });
        }

        @Override
        public void onAttachOrDetach(AttachEvent event) {
            if(registration != null) {
                registration.removeHandler();
            }
            registration = inputWidget.addBlurHandler(new BlurHandler() {
                @Override
                public void onBlur(BlurEvent event) {
                    validate(isValidateOnBlur());
                }
            });
        }

Replace Anonymous With Lambda gwt.material.design.client.base.mixin.BlankValidatorMixin.attachHandler.new AttachEvent.Handler.onAttachOrDetach.addBlurHandler.new BlurHandler with blurEvent -> {validate(isValidateOnBlur()); in method public onAttachOrDetach(event AttachEvent) : void from class gwt.material.design.client.base.mixin.BlankValidatorMixin.attachHandler.new AttachEvent.Handler


    protected HandlerRegistration setupBlurValidation() {
        if(!inputWidget.isAttached()) {
            return inputWidget.addAttachHandler(attachHandler);
        } else {
            return inputWidget.addBlurHandler(event -> {
                validate(isValidateOnBlur());
            });
        }
    }

    protected HandlerRegistration setupBlurValidation() {
        if(!inputWidget.isAttached()) {
            return inputWidget.addAttachHandler(attachHandler);
        } else {
            return inputWidget.addBlurHandler(new BlurHandler() {
                @Override
                public void onBlur(BlurEvent event) {
                    validate(isValidateOnBlur());
                }
            });
        }
    }

Replace Anonymous With Lambda gwt.material.design.client.base.mixin.BlankValidatorMixin.setupBlurValidation.addBlurHandler.new BlurHandler with event -> {validate(isValidateOnBlur()); in method protected setupBlurValidation() : HandlerRegistration from class gwt.material.design.client.base.mixin.BlankValidatorMixin


    @Override
    public void setEnabled(boolean enabled) {
        if(!uiObject.isAttached() && handler == null) {
            handler = uiObject.addAttachHandler(event -> {
                if(event.isAttached()) {
                    applyEnabled(enabled, uiObject);
                } else if(handler != null) {
                    handler.removeHandler();
                    handler = null;
                }
            });
        } else {
            applyEnabled(enabled, uiObject);
        }
    }

    @Override
    public void setEnabled(boolean enabled) {
        if(!uiObject.isAttached() && handler == null) {
            handler = uiObject.addAttachHandler(new AttachEvent.Handler() {
                @Override
                public void onAttachOrDetach(AttachEvent event) {
                    if(event.isAttached()) {
                        applyEnabled(enabled, uiObject);
                    } else if(handler != null) {
                        handler.removeHandler();
                        handler = null;
                    }
                }
            });
        } else {
            applyEnabled(enabled, uiObject);
        }
    }

Replace Anonymous With Lambda gwt.material.design.client.base.mixin.EnabledMixin.setEnabled.addAttachHandler.new AttachEvent.Handler with event -> {if(event.isAttached()){applyEnabled(enabled,uiObject); in method public setEnabled(enabled boolean) : void from class gwt.material.design.client.base.mixin.EnabledMixin


    protected HandlerRegistration setupValueChangeValidation() {
        return inputWidget.addHandler(event -> {
            validate(false);
        }, ValueChangeEvent.getType());
    }

    protected HandlerRegistration setupValueChangeValidation() {
        return inputWidget.addHandler(new ValueChangeHandler<V>() {
            @Override
            public void onValueChange(ValueChangeEvent<V> event) {
                validate(false);
            }
        }, ValueChangeEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.base.mixin.ValidatorMixin.setupValueChangeValidation.addHandler.new ValueChangeHandler<V> with event -> {validate(false); in method protected setupValueChangeValidation() : HandlerRegistration from class gwt.material.design.client.base.mixin.ValidatorMixin


    /**
     * Adds a field to the group.
     *
     * @param <T> the generic type
     * @param field the field
     */
    public <T extends Widget & HasValidators<?>> void add(final T field) {
        fields.put(field, field.validate(false));
        if (field.isAttached()) {
            updateStateAndNotify();
        }
        registrations.put(field, field.addValidationChangedHandler(event -> {
            fields.put(field, event.isValid());
            if (fireEvents) {
                updateStateAndNotify();
            }
        }));
    }

    /**
     * Adds a field to the group.
     *
     * @param <T> the generic type
     * @param field the field
     */
    public <T extends Widget & HasValidators<?>> void add(final T field) {
        fields.put(field, field.validate(false));
        if (field.isAttached()) {
            updateStateAndNotify();
        }
        registrations.put(field, field.addValidationChangedHandler(new ValidationChangedHandler() {
            @Override
            public void onValidationChanged(ValidationChangedEvent event) {
                fields.put(field, event.isValid());
                if (fireEvents) {
                    updateStateAndNotify();
                }
            }
        }));
    }

Replace Anonymous With Lambda gwt.material.design.client.base.validator.GroupValidator.add.put.addValidationChangedHandler.new ValidationChangedHandler with event -> {fields.put(field,event.isValid()); in method public add(field T) : void from class gwt.material.design.client.base.validator.GroupValidator


    @Override
    public HandlerRegistration addClickHandler(final ClickHandler handler) {
        return addHandler(event -> {
            if(isEnabled()){
                handler.onClick(event);
            }
        }, ClickEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialCheckBox.addClickHandler.addDomHandler.new ClickHandler with event -> {if(isEnabled()){handler.onClick(event); in method public addClickHandler(handler ClickHandler) : HandlerRegistration from class gwt.material.design.client.ui.MaterialCheckBox


    @Override
    public HandlerRegistration addMouseOutHandler(final MouseOutHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()){
                handler.onMouseOut(event);
            }
        }, MouseOutEvent.getType());
    }

    @Override
    public HandlerRegistration addMouseOutHandler(final MouseOutHandler handler) {
        return addDomHandler(new MouseOutHandler() {
            @Override
            public void onMouseOut(MouseOutEvent event) {
                if(isEnabled()){
                    handler.onMouseOut(event);
                }
            }
        }, MouseOutEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialChip.addMouseOutHandler.addDomHandler.new MouseOutHandler with event -> {if(isEnabled()){handler.onMouseOut(event); in method public addMouseOutHandler(handler MouseOutHandler) : HandlerRegistration from class gwt.material.design.client.ui.MaterialChip


    @Override
    public HandlerRegistration addMouseOverHandler(final MouseOverHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()){
                handler.onMouseOver(event);
            }
        }, MouseOverEvent.getType());
    }

    @Override
    public HandlerRegistration addMouseOverHandler(final MouseOverHandler handler) {
        return addDomHandler(new MouseOverHandler() {
            @Override
            public void onMouseOver(MouseOverEvent event) {
                if(isEnabled()){
                    handler.onMouseOver(event);
                }
            }
        }, MouseOverEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialChip.addMouseOverHandler.addDomHandler.new MouseOverHandler with event -> {if(isEnabled()){handler.onMouseOver(event); in method public addMouseOverHandler(handler MouseOverHandler) : HandlerRegistration from class gwt.material.design.client.ui.MaterialChip


    @Override
    public HandlerRegistration addMouseUpHandler(final MouseUpHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()){
                handler.onMouseUp(event);
            }
        }, MouseUpEvent.getType());
    }

    @Override
    public HandlerRegistration addMouseUpHandler(final MouseUpHandler handler) {
        return addDomHandler(new MouseUpHandler() {
            @Override
            public void onMouseUp(MouseUpEvent event) {
                if(isEnabled()){
                    handler.onMouseUp(event);
                }
            }
        }, MouseUpEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialChip.addMouseUpHandler.addDomHandler.new MouseUpHandler with event -> {if(isEnabled()){handler.onMouseUp(event); in method public addMouseUpHandler(handler MouseUpHandler) : HandlerRegistration from class gwt.material.design.client.ui.MaterialChip


    @Override
    public HandlerRegistration addMouseWheelHandler(final MouseWheelHandler handler) {
        return addDomHandler(event -> {
            if(isEnabled()){
                handler.onMouseWheel(event);
            }
        }, MouseWheelEvent.getType());
    }

    @Override
    public HandlerRegistration addMouseWheelHandler(final MouseWheelHandler handler) {
        return addDomHandler(new MouseWheelHandler() {
            @Override
            public void onMouseWheel(MouseWheelEvent event) {
                if(isEnabled()){
                    handler.onMouseWheel(event);
                }
            }
        }, MouseWheelEvent.getType());
    }

Replace Anonymous With Lambda gwt.material.design.client.ui.MaterialChip.addMouseWheelHandler.addDomHandler.new MouseWheelHandler with event -> {if(isEnabled()){handler.onMouseWheel(event); in method public addMouseWheelHandler(handler MouseWheelHandler) : HandlerRegistration from class gwt.material.design.client.ui.MaterialChip