  private void setNonWorkingIssuePatterns() {
    List<String> tempIssuePatternList = (List<String>) globalSettings.get(
        GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_KEY_PREFIX
            + GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_SUMMARY_FILTERS);
    if (tempIssuePatternList != null) {
      // add non working issues
      nonWorkingIssuePatterns = new ArrayList<>();
      for (String tempIssuePattern : tempIssuePatternList) {
        nonWorkingIssuePatterns.add(Pattern.compile(tempIssuePattern));
      }
    } else {
      // default! from properties load default issues!!
      nonWorkingIssuePatterns = defaultNonWorkingIssueIds;
    }
  }

  private void setNonWorkingIssuePatterns() {
    List<String> tempIssuePatternList = (List<String>) globalSettings.get(
        GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_KEY_PREFIX
            + GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_SUMMARY_FILTERS);
    if (tempIssuePatternList != null) {
      // add non working issues
      nonWorkingIssuePatterns = new ArrayList<Pattern>();
      for (String tempIssuePattern : tempIssuePatternList) {
        nonWorkingIssuePatterns.add(Pattern.compile(tempIssuePattern));
      }
    } else {
      // default! from properties load default issues!!
      nonWorkingIssuePatterns = defaultNonWorkingIssueIds;
    }
  }

Replace Generic With Diamond ArrayList<Pattern> with ArrayList<> in method private setNonWorkingIssuePatterns() : void from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  private void setPluginGroups() {
    List<String> pluginGroupsNames = (List<String>) globalSettings
        .get(GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_KEY_PREFIX
            + GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_PLUGIN_PERMISSION);
    pluginGroups = new ArrayList<>();
    if (pluginGroupsNames != null) {
      pluginGroups = pluginGroupsNames;
    }
  }

  private void setPluginGroups() {
    List<String> pluginGroupsNames = (List<String>) globalSettings
        .get(GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_KEY_PREFIX
            + GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_PLUGIN_PERMISSION);
    pluginGroups = new ArrayList<String>();
    if (pluginGroupsNames != null) {
      pluginGroups = pluginGroupsNames;
    }
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private setPluginGroups() : void from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  private void setTimetrackerGroups() {
    List<String> timetrackerGroupsNames = (List<String>) globalSettings
        .get(GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_KEY_PREFIX
            + GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_TIMETRACKER_PERMISSION);
    timetrackerGroups = new ArrayList<>();
    if (timetrackerGroupsNames != null) {
      timetrackerGroups = timetrackerGroupsNames;
    }
  }

  private void setTimetrackerGroups() {
    List<String> timetrackerGroupsNames = (List<String>) globalSettings
        .get(GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_KEY_PREFIX
            + GlobalSettingsKey.JTTP_PLUGIN_SETTINGS_TIMETRACKER_PERMISSION);
    timetrackerGroups = new ArrayList<String>();
    if (timetrackerGroupsNames != null) {
      timetrackerGroups = timetrackerGroupsNames;
    }
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private setTimetrackerGroups() : void from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  @Override
  public long summary(final Date startSummary,
      final Date finishSummary,
      final List<Pattern> issuePatterns) throws GenericEntityException {
    // TODO JIRAPLUGIN-348 refactor
    JiraAuthenticationContext authenticationContext = ComponentAccessor
        .getJiraAuthenticationContext();
    ApplicationUser user = authenticationContext.getUser();

    Calendar start = Calendar.getInstance();
    start.setTime(startSummary);
    Calendar finish = Calendar.getInstance();
    finish.setTime(finishSummary);

    List<EntityCondition> exprList = createWorklogQueryExprList(user,
        start, finish);

    List<GenericValue> worklogs;
    // worklog query
    worklogs = ComponentAccessor.getOfBizDelegator().findByAnd("Worklog",
        exprList);
    List<GenericValue> worklogsCopy = new ArrayList<>();
    worklogsCopy.addAll(worklogs);
    // if we have non-estimated issues
    if ((issuePatterns != null) && !issuePatterns.isEmpty()) {
      for (GenericValue worklog : worklogsCopy) {
        IssueManager issueManager = ComponentAccessor.getIssueManager();
        Long issueId = worklog.getLong("issue");
        MutableIssue issue = issueManager.getIssueObject(issueId);
        for (Pattern issuePattern : issuePatterns) {
          boolean issueMatches = issuePattern.matcher(issue.getKey())
              .matches();
          // if match not count in summary
          if (issueMatches) {
            worklogs.remove(worklog);
            break;
          }
        }
      }
    }
    long timeSpent = 0;
    for (GenericValue worklog : worklogs) {
      timeSpent += worklog.getLong("timeworked").longValue();
    }
    return timeSpent;
  }

  @Override
  public long summary(final Date startSummary,
      final Date finishSummary,
      final List<Pattern> issuePatterns) throws GenericEntityException {
    // TODO JIRAPLUGIN-348 refactor
    JiraAuthenticationContext authenticationContext = ComponentAccessor
        .getJiraAuthenticationContext();
    ApplicationUser user = authenticationContext.getUser();

    Calendar start = Calendar.getInstance();
    start.setTime(startSummary);
    Calendar finish = Calendar.getInstance();
    finish.setTime(finishSummary);

    List<EntityCondition> exprList = createWorklogQueryExprList(user,
        start, finish);

    List<GenericValue> worklogs;
    // worklog query
    worklogs = ComponentAccessor.getOfBizDelegator().findByAnd("Worklog",
        exprList);
    List<GenericValue> worklogsCopy = new ArrayList<GenericValue>();
    worklogsCopy.addAll(worklogs);
    // if we have non-estimated issues
    if ((issuePatterns != null) && !issuePatterns.isEmpty()) {
      for (GenericValue worklog : worklogsCopy) {
        IssueManager issueManager = ComponentAccessor.getIssueManager();
        Long issueId = worklog.getLong("issue");
        MutableIssue issue = issueManager.getIssueObject(issueId);
        for (Pattern issuePattern : issuePatterns) {
          boolean issueMatches = issuePattern.matcher(issue.getKey())
              .matches();
          // if match not count in summary
          if (issueMatches) {
            worklogs.remove(worklog);
            break;
          }
        }
      }
    }
    long timeSpent = 0;
    for (GenericValue worklog : worklogs) {
      timeSpent += worklog.getLong("timeworked").longValue();
    }
    return timeSpent;
  }

Replace Generic With Diamond ArrayList<GenericValue> with ArrayList<> in method public summary(startSummary Date, finishSummary Date, issuePatterns List<Pattern>) : long from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  @Override
  public List<MissingsWorklogsDTO> getDates(final String selectedUser, final Date from,
      final Date to,
      final boolean workingHour, final boolean checkNonWorking)
      throws GenericEntityException {
    List<MissingsWorklogsDTO> datesWhereNoWorklog = new ArrayList<>();
    Calendar fromDate = Calendar.getInstance();
    fromDate.setTime(from);
    Calendar toDate = Calendar.getInstance();
    toDate.setTime(to);
    while (!fromDate.after(toDate)) {
      String currentDateString = DateTimeConverterUtil.dateToFixFormatString(fromDate.getTime());
      if (excludeDatesSet.contains(currentDateString)) {
        fromDate.add(Calendar.DATE, 1);
        continue;
      }
      // check includes - not check weekend
      // check weekend - pass
      if (!includeDatesSet.contains(currentDateString)
          && ((fromDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
              || (fromDate.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY))) {
        fromDate.add(Calendar.DATE, 1);
        continue;
      }
      // check worklog. if no worklog set result else ++ scanedDate
      DecimalFormat decimalFormat = new DecimalFormat("#.#");

      if (workingHour) {
        double missingsTime = isContainsEnoughWorklog(fromDate.getTime(),
            checkNonWorking);
        if (missingsTime > 0) {
          missingsTime = missingsTime / DateTimeConverterUtil.SECONDS_PER_MINUTE
              / DateTimeConverterUtil.MINUTES_PER_HOUR;
          // BigDecimal bd =
          // new BigDecimal(Double.toString(missingsTime)).setScale(2, RoundingMode.HALF_EVEN);
          // missingsTime = bd.doubleValue();
          datesWhereNoWorklog
              .add(new MissingsWorklogsDTO((Date) fromDate.getTime().clone(),
                  decimalFormat.format(missingsTime)));
        }
      } else {
        if (!isContainsWorklog(fromDate.getTime())) {
          datesWhereNoWorklog.add(new MissingsWorklogsDTO((Date) fromDate.getTime().clone(),
              decimalFormat.format(timeTrackingConfiguration.getHoursPerDay().doubleValue())));
        }
      }

      fromDate.add(Calendar.DATE, 1);

    }
    Collections.reverse(datesWhereNoWorklog);
    return datesWhereNoWorklog;
  }

  @Override
  public List<MissingsWorklogsDTO> getDates(final String selectedUser, final Date from,
      final Date to,
      final boolean workingHour, final boolean checkNonWorking)
          throws GenericEntityException {
    List<MissingsWorklogsDTO> datesWhereNoWorklog = new ArrayList<MissingsWorklogsDTO>();
    Calendar fromDate = Calendar.getInstance();
    fromDate.setTime(from);
    Calendar toDate = Calendar.getInstance();
    toDate.setTime(to);
    while (!fromDate.after(toDate)) {
      String currentDateString = DateTimeConverterUtil.dateToFixFormatString(fromDate.getTime());
      if (excludeDatesSet.contains(currentDateString)) {
        fromDate.add(Calendar.DATE, 1);
        continue;
      }
      // check includes - not check weekend
      // check weekend - pass
      if (!includeDatesSet.contains(currentDateString)
          && ((fromDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
              || (fromDate.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY))) {
        fromDate.add(Calendar.DATE, 1);
        continue;
      }
      // check worklog. if no worklog set result else ++ scanedDate
      DecimalFormat decimalFormat = new DecimalFormat("#.#");

      if (workingHour) {
        double missingsTime = isContainsEnoughWorklog(fromDate.getTime(),
            checkNonWorking);
        if (missingsTime > 0) {
          missingsTime = missingsTime / DateTimeConverterUtil.SECONDS_PER_MINUTE
              / DateTimeConverterUtil.MINUTES_PER_HOUR;
          // BigDecimal bd =
          // new BigDecimal(Double.toString(missingsTime)).setScale(2, RoundingMode.HALF_EVEN);
          // missingsTime = bd.doubleValue();
          datesWhereNoWorklog
              .add(new MissingsWorklogsDTO((Date) fromDate.getTime().clone(),
                  decimalFormat.format(missingsTime)));
        }
      } else {
        if (!isContainsWorklog(fromDate.getTime())) {
          datesWhereNoWorklog.add(new MissingsWorklogsDTO((Date) fromDate.getTime().clone(),
              decimalFormat.format(timeTrackingConfiguration.getHoursPerDay().doubleValue())));
        }
      }

      fromDate.add(Calendar.DATE, 1);

    }
    Collections.reverse(datesWhereNoWorklog);
    return datesWhereNoWorklog;
  }

Replace Generic With Diamond ArrayList<MissingsWorklogsDTO> with ArrayList<> in method public getDates(selectedUser String, from Date, to Date, workingHour boolean, checkNonWorking boolean) : List<MissingsWorklogsDTO> from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  @Override
  public List<EveritWorklog> getWorklogs(final String selectedUser, final Date date,
      final Date finalDate)
      throws ParseException {
    Calendar startDate = DateTimeConverterUtil.setDateToDayStart(date);
    Calendar endDate = (Calendar) startDate.clone();
    if (finalDate == null) {
      endDate.add(Calendar.DAY_OF_MONTH, 1);
    } else {
      endDate = DateTimeConverterUtil.setDateToDayStart(finalDate);
      endDate.add(Calendar.DAY_OF_MONTH, 1);
    }

    List<EveritWorklog> worklogs = new ArrayList<>();

    JiraAuthenticationContext authenticationContext = ComponentAccessor
        .getJiraAuthenticationContext();
    ApplicationUser loggedInUser = authenticationContext.getUser();

    String userKey;
    if ((selectedUser == null) || "".equals(selectedUser)) {
      userKey = loggedInUser.getKey();
    } else {
      userKey = ComponentAccessor.getUserUtil().getUserByName(selectedUser).getKey();
    }

    List<EntityCondition> exprList = createWorklogQueryExprListWithPermissionCheck(userKey,
        loggedInUser, startDate, endDate);

    List<GenericValue> worklogGVList = ComponentAccessor.getOfBizDelegator()
        .findByAnd("IssueWorklogView", exprList);

    for (GenericValue worklogGv : worklogGVList) {
      EveritWorklog worklog = new EveritWorklog(worklogGv);
      worklogs.add(worklog);
    }

    Collections.sort(worklogs, EveritWorklogComparator.INSTANCE);
    return worklogs;
  }

  @Override
  public List<EveritWorklog> getWorklogs(final String selectedUser, final Date date,
      final Date finalDate)
          throws ParseException {
    Calendar startDate = DateTimeConverterUtil.setDateToDayStart(date);
    Calendar endDate = (Calendar) startDate.clone();
    if (finalDate == null) {
      endDate.add(Calendar.DAY_OF_MONTH, 1);
    } else {
      endDate = DateTimeConverterUtil.setDateToDayStart(finalDate);
      endDate.add(Calendar.DAY_OF_MONTH, 1);
    }

    List<EveritWorklog> worklogs = new ArrayList<EveritWorklog>();

    JiraAuthenticationContext authenticationContext = ComponentAccessor
        .getJiraAuthenticationContext();
    ApplicationUser loggedInUser = authenticationContext.getUser();

    String userKey;
    if ((selectedUser == null) || "".equals(selectedUser)) {
      userKey = loggedInUser.getKey();
    } else {
      userKey = ComponentAccessor.getUserUtil().getUserByName(selectedUser).getKey();
    }

    List<EntityCondition> exprList = createWorklogQueryExprListWithPermissionCheck(userKey,
        loggedInUser, startDate, endDate);

    List<GenericValue> worklogGVList = ComponentAccessor.getOfBizDelegator()
        .findByAnd("IssueWorklogView", exprList);

    for (GenericValue worklogGv : worklogGVList) {
      EveritWorklog worklog = new EveritWorklog(worklogGv);
      worklogs.add(worklog);
    }

    Collections.sort(worklogs, EveritWorklogComparator.INSTANCE);
    return worklogs;
  }

Replace Generic With Diamond ArrayList<EveritWorklog> with ArrayList<> in method public getWorklogs(selectedUser String, date Date, finalDate Date) : List<EveritWorklog> from class org.everit.jira.timetracker.plugin.JiraTimetrackerPluginImpl


  @Override
  public long summary(final Date startSummary,
      final Date finishSummary,
      final List<Pattern> issuePatterns) throws GenericEntityException {
    JiraAuthenticationContext authenticationContext = ComponentAccessor
        .getJiraAuthenticationContext();
    ApplicationUser user = authenticationContext.getUser();

    Calendar start = Calendar.getInstance();
    start.setTime(startSummary);
    Calendar finish = Calendar.getInstance();
    finish.setTime(finishSummary);

    List<EntityCondition> exprList = createWorklogQueryExprList(user,
        start, finish);

    List<GenericValue> worklogs;
    // worklog query
    worklogs = ComponentAccessor.getOfBizDelegator().findByAnd("Worklog",
        exprList);
    List<GenericValue> worklogsCopy = new ArrayList<>();
    worklogsCopy.addAll(worklogs);
    // if we have non-estimated issues
    if ((issuePatterns != null) && !issuePatterns.isEmpty()) {
      for (GenericValue worklog : worklogsCopy) {
        IssueManager issueManager = ComponentAccessor.getIssueManager();
        Long issueId = worklog.getLong("issue");
        MutableIssue issue = issueManager.getIssueObject(issueId);
        for (Pattern issuePattern : issuePatterns) {
          boolean issueMatches = issuePattern.matcher(issue.getKey())
              .matches();
          // if match not count in summary
          if (issueMatches) {
            worklogs.remove(worklog);
            break;
          }
        }
      }
    }
    long timeSpent = 0;
    for (GenericValue worklog : worklogs) {
      timeSpent += worklog.getLong("timeworked").longValue();
    }
    return timeSpent;
  }

  @Override
  public long summary(final Date startSummary,
      final Date finishSummary,
      final List<Pattern> issuePatterns) throws GenericEntityException {
    JiraAuthenticationContext authenticationContext = ComponentAccessor
        .getJiraAuthenticationContext();
    ApplicationUser user = authenticationContext.getUser();

    Calendar start = Calendar.getInstance();
    start.setTime(startSummary);
    Calendar finish = Calendar.getInstance();
    finish.setTime(finishSummary);

    List<EntityCondition> exprList = createWorklogQueryExprList(user,
        start, finish);

    List<GenericValue> worklogs;
    // worklog query
    worklogs = ComponentAccessor.getOfBizDelegator().findByAnd("Worklog",
        exprList);
    List<GenericValue> worklogsCopy = new ArrayList<GenericValue>();
    worklogsCopy.addAll(worklogs);
    // if we have non-estimated issues
    if ((issuePatterns != null) && !issuePatterns.isEmpty()) {
      for (GenericValue worklog : worklogsCopy) {
        IssueManager issueManager = ComponentAccessor.getIssueManager();
        Long issueId = worklog.getLong("issue");
        MutableIssue issue = issueManager.getIssueObject(issueId);
        for (Pattern issuePattern : issuePatterns) {
          boolean issueMatches = issuePattern.matcher(issue.getKey())
              .matches();
          // if match not count in summary
          if (issueMatches) {
            worklogs.remove(worklog);
            break;
          }
        }
      }
    }
    long timeSpent = 0;
    for (GenericValue worklog : worklogs) {
      timeSpent += worklog.getLong("timeworked").longValue();
    }
    return timeSpent;
  }


  private void parsePluginGroups(final String[] pluginGroupsvalue) {
    if (pluginGroupsvalue == null) {
      pluginGroups = new ArrayList<>();
    } else {
      pluginGroups = Arrays.asList(pluginGroupsvalue);
    }
  }

  private void parsePluginGroups(final String[] pluginGroupsvalue) {
    if (pluginGroupsvalue == null) {
      pluginGroups = new ArrayList<String>();
    } else {
      pluginGroups = Arrays.asList(pluginGroupsvalue);
    }
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private parsePluginGroups(pluginGroupsvalue String[]) : void from class org.everit.jira.timetracker.plugin.web.AdminSettingsWebAction


  private void parseTimetrackerGroups(final String[] timetrackerGroupsValue) {
    if (timetrackerGroupsValue == null) {
      timetrackerGroups = new ArrayList<>();
    } else {
      timetrackerGroups = Arrays.asList(timetrackerGroupsValue);
    }
  }

  private void parseTimetrackerGroups(final String[] timetrackerGroupsValue) {
    if (timetrackerGroupsValue == null) {
      timetrackerGroups = new ArrayList<String>();
    } else {
      timetrackerGroups = Arrays.asList(timetrackerGroupsValue);
    }
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private parseTimetrackerGroups(timetrackerGroupsValue String[]) : void from class org.everit.jira.timetracker.plugin.web.AdminSettingsWebAction


  private void addToDaySummary(final EveritWorklog worklog) {
    int dayNo = worklog.getDayNo();
    ArrayList<Object> list = new ArrayList<>();
    Long prevDaySum = (daySum.get(dayNo) == null) ? Long.valueOf(0)
        : (Long) daySum.get(dayNo).get(0);
    Long sumSec = prevDaySum + (worklog.getMilliseconds() / MILLISEC_IN_SEC);
    list.add(sumSec);
    list.add(durationFormatter.exactDuration(sumSec));
    daySum.put(dayNo, list);
  }

  private void addToDaySummary(final EveritWorklog worklog) {
    int dayNo = worklog.getDayNo();
    ArrayList<Object> list = new ArrayList<Object>();
    Long prevDaySum = (daySum.get(dayNo) == null) ? Long.valueOf(0)
        : (Long) daySum.get(dayNo).get(0);
    Long sumSec = prevDaySum + (worklog.getMilliseconds() / MILLISEC_IN_SEC);
    list.add(sumSec);
    list.add(durationFormatter.exactDuration(sumSec));
    daySum.put(dayNo, list);
  }

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method private addToDaySummary(worklog EveritWorklog) : void from class org.everit.jira.reporting.plugin.web.JiraTimetrackerTableWebAction


  private void addToMonthSummary(final EveritWorklog worklog) {
    int monthNo = worklog.getMonthNo();
    ArrayList<Object> list = new ArrayList<>();
    Long prevMonthSum = (monthSum.get(monthNo) == null) ? Long.valueOf(0)
        : (Long) monthSum.get(monthNo).get(0);
    Long sumSec = prevMonthSum + (worklog.getMilliseconds() / MILLISEC_IN_SEC);
    list.add(sumSec);
    list.add(durationFormatter.exactDuration(sumSec));
    monthSum.put(monthNo, list);
  }

  private void addToMonthSummary(final EveritWorklog worklog) {
    int monthNo = worklog.getMonthNo();
    ArrayList<Object> list = new ArrayList<Object>();
    Long prevMonthSum = (monthSum.get(monthNo) == null) ? Long.valueOf(0)
        : (Long) monthSum.get(monthNo).get(0);
    Long sumSec = prevMonthSum + (worklog.getMilliseconds() / MILLISEC_IN_SEC);
    list.add(sumSec);
    list.add(durationFormatter.exactDuration(sumSec));
    monthSum.put(monthNo, list);
  }

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method private addToMonthSummary(worklog EveritWorklog) : void from class org.everit.jira.reporting.plugin.web.JiraTimetrackerTableWebAction


  private void addToRealDaySummary(final EveritWorklog worklog, final boolean isRealWorklog) {
    int dayNo = worklog.getDayNo();
    ArrayList<Object> realList = new ArrayList<>();
    Long prevRealDaySum = (realDaySum.get(dayNo) == null) ? Long.valueOf(0)
        : (Long) realDaySum.get(dayNo).get(0);
    Long realSumSec = prevRealDaySum;
    if (isRealWorklog) {
      realSumSec += (worklog.getMilliseconds() / MILLISEC_IN_SEC);
    }
    realList.add(realSumSec);
    realList.add(durationFormatter.exactDuration(realSumSec));
    realDaySum.put(dayNo, realList);
  }

  private void addToRealDaySummary(final EveritWorklog worklog, final boolean isRealWorklog) {
    int dayNo = worklog.getDayNo();
    ArrayList<Object> realList = new ArrayList<Object>();
    Long prevRealDaySum = (realDaySum.get(dayNo) == null) ? Long.valueOf(0)
        : (Long) realDaySum.get(dayNo).get(0);
    Long realSumSec = prevRealDaySum;
    if (isRealWorklog) {
      realSumSec += (worklog.getMilliseconds() / MILLISEC_IN_SEC);
    }
    realList.add(realSumSec);
    realList.add(durationFormatter.exactDuration(realSumSec));
    realDaySum.put(dayNo, realList);
  }

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method private addToRealDaySummary(worklog EveritWorklog, isRealWorklog boolean) : void from class org.everit.jira.reporting.plugin.web.JiraTimetrackerTableWebAction


  private void addToRealMonthSummary(final EveritWorklog worklog, final boolean isRealWorklog) {
    int monthNo = worklog.getMonthNo();
    ArrayList<Object> realList = new ArrayList<>();
    Long prevRealMonthSum = realMonthSum.get(monthNo) == null ? Long.valueOf(0)
        : (Long) realMonthSum.get(monthNo).get(0);
    Long realSumSec = prevRealMonthSum;
    if (isRealWorklog) {
      realSumSec += (worklog.getMilliseconds() / MILLISEC_IN_SEC);
    }
    realList.add(realSumSec);
    realList.add(durationFormatter.exactDuration(realSumSec));
    realMonthSum.put(monthNo, realList);
  }

  private void addToRealMonthSummary(final EveritWorklog worklog, final boolean isRealWorklog) {
    int monthNo = worklog.getMonthNo();
    ArrayList<Object> realList = new ArrayList<Object>();
    Long prevRealMonthSum = realMonthSum.get(monthNo) == null ? Long.valueOf(0)
        : (Long) realMonthSum.get(monthNo).get(0);
    Long realSumSec = prevRealMonthSum;
    if (isRealWorklog) {
      realSumSec += (worklog.getMilliseconds() / MILLISEC_IN_SEC);
    }
    realList.add(realSumSec);
    realList.add(durationFormatter.exactDuration(realSumSec));
    realMonthSum.put(monthNo, realList);
  }

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method private addToRealMonthSummary(worklog EveritWorklog, isRealWorklog boolean) : void from class org.everit.jira.reporting.plugin.web.JiraTimetrackerTableWebAction


  private void addToRealWeekSummary(final EveritWorklog worklog, final boolean isRealWorklog) {
    int weekNo = worklog.getWeekNo();
    ArrayList<Object> realList = new ArrayList<>();
    Long prevRealWeekSum = realWeekSum.get(weekNo) == null ? Long.valueOf(0)
        : (Long) realWeekSum.get(weekNo).get(0);
    Long realSumSec = prevRealWeekSum;
    if (isRealWorklog) {
      realSumSec += (worklog.getMilliseconds() / MILLISEC_IN_SEC);
    }
    realList.add(realSumSec);
    realList.add(durationFormatter.exactDuration(realSumSec));
    realWeekSum.put(weekNo, realList);
  }

  private void addToRealWeekSummary(final EveritWorklog worklog, final boolean isRealWorklog) {
    int weekNo = worklog.getWeekNo();
    ArrayList<Object> realList = new ArrayList<Object>();
    Long prevRealWeekSum = realWeekSum.get(weekNo) == null ? Long.valueOf(0)
        : (Long) realWeekSum.get(weekNo).get(0);
    Long realSumSec = prevRealWeekSum;
    if (isRealWorklog) {
      realSumSec += (worklog.getMilliseconds() / MILLISEC_IN_SEC);
    }
    realList.add(realSumSec);
    realList.add(durationFormatter.exactDuration(realSumSec));
    realWeekSum.put(weekNo, realList);
  }

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method private addToRealWeekSummary(worklog EveritWorklog, isRealWorklog boolean) : void from class org.everit.jira.reporting.plugin.web.JiraTimetrackerTableWebAction


  private void addToWeekSummary(final EveritWorklog worklog) {
    ArrayList<Object> list = new ArrayList<>();
    int weekNo = worklog.getWeekNo();
    Long prevWeekSum = weekSum.get(weekNo) == null ? Long.valueOf(0)
        : (Long) weekSum.get(weekNo).get(0);
    Long sumSec = prevWeekSum + (worklog.getMilliseconds() / MILLISEC_IN_SEC);
    list.add(sumSec);
    list.add(durationFormatter.exactDuration(sumSec));
    weekSum.put(weekNo, list);
  }

  private void addToWeekSummary(final EveritWorklog worklog) {
    ArrayList<Object> list = new ArrayList<Object>();
    int weekNo = worklog.getWeekNo();
    Long prevWeekSum = weekSum.get(weekNo) == null ? Long.valueOf(0)
        : (Long) weekSum.get(weekNo).get(0);
    Long sumSec = prevWeekSum + (worklog.getMilliseconds() / MILLISEC_IN_SEC);
    list.add(sumSec);
    list.add(durationFormatter.exactDuration(sumSec));
    weekSum.put(weekNo, list);
  }

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method private addToWeekSummary(worklog EveritWorklog) : void from class org.everit.jira.reporting.plugin.web.JiraTimetrackerTableWebAction


  @Override
  public String doExecute() throws ParseException, GenericEntityException {
    String checkConditionsResult = checkConditions();
    if (checkConditionsResult != null) {
      return checkConditionsResult;
    }

    createDurationFormatter();

    loadIssueCollectorSrc();
    normalizeContextPath();
    loadPluginSettingAndParseResult();
    hasBrowseUsersPermission =
        PermissionUtil.hasBrowseUserPermission(getLoggedInApplicationUser(), reportingPlugin);

    analyticsDTO = JiraTimetrackerAnalytics.getAnalyticsDTO(pluginSettingsFactory,
        PiwikPropertiesUtil.PIWIK_TABLE_SITEID);

    Calendar startDate = null;
    Calendar lastDate = null;
    try {
      setCurrentUserFromParam();
      setUserPickerObjectBasedOnCurrentUser();
      startDate = parseDateFrom();
      lastDate = parseDateTo();
      validateDates(startDate, lastDate);
    } catch (IllegalArgumentException e) {
      message = e.getMessage();
      return INPUT;
    }

    worklogs = new ArrayList<>();
    try {
      worklogs.addAll(jiraTimetrackerPlugin.getWorklogs(currentUser, startDate.getTime(),
          lastDate.getTime()));
      saveDataToSession();
    } catch (DataAccessException | SQLException e) {
      LOGGER.error(GET_WORKLOGS_ERROR_MESSAGE, e);
      return ERROR;
    }

    Collections.sort(worklogs, new OrderByDate());

    for (EveritWorklog worklog : worklogs) {
      Calendar calendar = Calendar.getInstance();
      calendar.setTime(worklog.getDate());

      boolean isRealWorklog = isRealWorklog(worklog);

      addToMonthSummary(worklog);
      addToRealMonthSummary(worklog, isRealWorklog);

      addToWeekSummary(worklog);
      addToRealWeekSummary(worklog, isRealWorklog);

      addToDaySummary(worklog);
      addToRealDaySummary(worklog, isRealWorklog);
    }

    return SUCCESS;
  }

  @Override
  public String doExecute() throws ParseException, GenericEntityException {
    String checkConditionsResult = checkConditions();
    if (checkConditionsResult != null) {
      return checkConditionsResult;
    }

    createDurationFormatter();

    loadIssueCollectorSrc();
    normalizeContextPath();
    loadPluginSettingAndParseResult();
    hasBrowseUsersPermission =
        PermissionUtil.hasBrowseUserPermission(getLoggedInApplicationUser(), reportingPlugin);

    analyticsDTO = JiraTimetrackerAnalytics.getAnalyticsDTO(pluginSettingsFactory,
        PiwikPropertiesUtil.PIWIK_TABLE_SITEID);

    Calendar startDate = null;
    Calendar lastDate = null;
    try {
      setCurrentUserFromParam();
      setUserPickerObjectBasedOnCurrentUser();
      startDate = parseDateFrom();
      lastDate = parseDateTo();
      validateDates(startDate, lastDate);
    } catch (IllegalArgumentException e) {
      message = e.getMessage();
      return INPUT;
    }

    worklogs = new ArrayList<EveritWorklog>();
    try {
      worklogs.addAll(jiraTimetrackerPlugin.getWorklogs(currentUser, startDate.getTime(),
          lastDate.getTime()));
      saveDataToSession();
    } catch (DataAccessException | SQLException e) {
      LOGGER.error(GET_WORKLOGS_ERROR_MESSAGE, e);
      return ERROR;
    }

    Collections.sort(worklogs, new OrderByDate());

    for (EveritWorklog worklog : worklogs) {
      Calendar calendar = Calendar.getInstance();
      calendar.setTime(worklog.getDate());

      boolean isRealWorklog = isRealWorklog(worklog);

      addToMonthSummary(worklog);
      addToRealMonthSummary(worklog, isRealWorklog);

      addToWeekSummary(worklog);
      addToRealWeekSummary(worklog, isRealWorklog);

      addToDaySummary(worklog);
      addToRealDaySummary(worklog, isRealWorklog);
    }

    return SUCCESS;
  }

Replace Generic With Diamond ArrayList<EveritWorklog> with ArrayList<> in method public doExecute() : String from class org.everit.jira.reporting.plugin.web.JiraTimetrackerTableWebAction


  private void defaultInitalizeData() {
    selectedMore = new ArrayList<>();
    filterCondition = new FilterCondition();
    if (!hasBrowseUsersPermission) {
      filterCondition.setUsers(Arrays.asList(PickerUserDTO.CURRENT_USER_NAME));
    }
    String selectedWorklogDetailsColumnsJson = loadUserWorklogDetialsSelectedColumnsJson();
    String[] selectedWorklogDetailsColumnsArray =
        gson.fromJson(selectedWorklogDetailsColumnsJson, String[].class);
    selectedWorklogDetailsColumns = Arrays.asList(selectedWorklogDetailsColumnsArray);
    initDatesIfNecessary();
  }

  private void defaultInitalizeData() {
    selectedMore = new ArrayList<String>();
    filterCondition = new FilterCondition();
    if (!hasBrowseUsersPermission) {
      filterCondition.setUsers(Arrays.asList(PickerUserDTO.CURRENT_USER_NAME));
    }
    String selectedWorklogDetailsColumnsJson = loadUserWorklogDetialsSelectedColumnsJson();
    String[] selectedWorklogDetailsColumnsArray =
        gson.fromJson(selectedWorklogDetailsColumnsJson, String[].class);
    selectedWorklogDetailsColumns = Arrays.asList(selectedWorklogDetailsColumnsArray);
    initDatesIfNecessary();
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private defaultInitalizeData() : void from class org.everit.jira.reporting.plugin.web.ReportingWebAction


  private void loadFavoriteFilters() {
    DefaultSearchRequestService defaultSearchRequestService =
        ComponentAccessor.getComponentOfType(DefaultSearchRequestService.class);
    favouriteFilters = new ArrayList<>(
        defaultSearchRequestService.getFavouriteFilters(getLoggedInApplicationUser()));
  }

  private void loadFavoriteFilters() {
    DefaultSearchRequestService defaultSearchRequestService =
        ComponentAccessor.getComponentOfType(DefaultSearchRequestService.class);
    favouriteFilters = new ArrayList<SearchRequest>(
        defaultSearchRequestService.getFavouriteFilters(getLoggedInApplicationUser()));
  }

Replace Generic With Diamond ArrayList<SearchRequest> with ArrayList<> in method private loadFavoriteFilters() : void from class org.everit.jira.reporting.plugin.web.ReportingWebAction


  /**
   * Put the worklogs id into a array.
   *
   * @param worklogsParam
   *          The worklogs.
   * @return The array of the ids.
   */
  private List<Long> copyWorklogIdsToArray(final List<EveritWorklog> worklogsParam) {
    List<Long> worklogIds = new ArrayList<>();
    for (EveritWorklog worklog : worklogsParam) {
      worklogIds.add(worklog.getWorklogId());
    }
    return worklogIds;
  }

  /**
   * Put the worklogs id into a array.
   *
   * @param worklogsParam
   *          The worklogs.
   * @return The array of the ids.
   */
  private List<Long> copyWorklogIdsToArray(final List<EveritWorklog> worklogsParam) {
    List<Long> worklogIds = new ArrayList<Long>();
    for (EveritWorklog worklog : worklogsParam) {
      worklogIds.add(worklog.getWorklogId());
    }
    return worklogIds;
  }

Replace Generic With Diamond ArrayList<Long> with ArrayList<> in method private copyWorklogIdsToArray(worklogsParam List<EveritWorklog>) : List<Long> from class org.everit.jira.timetracker.plugin.web.JiraTimetrackerWebAction


  /**
   * Parses the {@link #editAllIds} string to a list of {@code Long} values.
   */
  public List<Long> parseEditAllIds() {
    String editAllValues = getHttpRequest().getParameter("editAll");
    List<Long> editWorklogIds = new ArrayList<>();
    if (editAllValues != null) {
      String editAllIdsCopy = editAllValues;
      editAllIdsCopy = editAllIdsCopy.replace("[", "");
      editAllIdsCopy = editAllIdsCopy.replace("]", "");
      editAllIdsCopy = editAllIdsCopy.replace(" ", "");
      if (editAllIdsCopy.trim().equals("")) {
        return Collections.emptyList();
      }
      String[] editIds = editAllIdsCopy.split(",");
      for (String editId : editIds) {
        editWorklogIds.add(Long.valueOf(editId));
      }
      return editWorklogIds;
    }
    return Collections.emptyList();
  }

  /**
   * Parses the {@link #editAllIds} string to a list of {@code Long} values.
   */
  public List<Long> parseEditAllIds() {
    String editAllValues = getHttpRequest().getParameter("editAll");
    List<Long> editWorklogIds = new ArrayList<Long>();
    if (editAllValues != null) {
      String editAllIdsCopy = editAllValues;
      editAllIdsCopy = editAllIdsCopy.replace("[", "");
      editAllIdsCopy = editAllIdsCopy.replace("]", "");
      editAllIdsCopy = editAllIdsCopy.replace(" ", "");
      if (editAllIdsCopy.trim().equals("")) {
        return Collections.emptyList();
      }
      String[] editIds = editAllIdsCopy.split(",");
      for (String editId : editIds) {
        editWorklogIds.add(Long.valueOf(editId));
      }
      return editWorklogIds;
    }
    return Collections.emptyList();
  }

Replace Generic With Diamond ArrayList<Long> with ArrayList<> in method public parseEditAllIds() : List<Long> from class org.everit.jira.timetracker.plugin.web.JiraTimetrackerWebAction


  /**
   * The readObject method for the transient variable.
   *
   * @param in
   *          The ObjectInputStream.
   * @throws IOException
   *           IOException.
   * @throws ClassNotFoundException
   *           ClassNotFoundException.
   */
  private void readObject(final ObjectInputStream in) throws IOException,
      ClassNotFoundException {
    in.defaultReadObject();
    issues = new ArrayList<>();
  }

  /**
   * The readObject method for the transient variable.
   *
   * @param in
   *          The ObjectInputStream.
   * @throws IOException
   *           IOException.
   * @throws ClassNotFoundException
   *           ClassNotFoundException.
   */
  private void readObject(final ObjectInputStream in) throws IOException,
      ClassNotFoundException {
    in.defaultReadObject();
    issues = new ArrayList<Issue>();
  }

Replace Generic With Diamond ArrayList<Issue> with ArrayList<> in method private readObject(in ObjectInputStream) : void from class org.everit.jira.timetracker.plugin.web.JiraTimetrackerWebAction


    @Override
    public Iterator<Double> iterator() {
        return new Iterator<>() {
            private Double current = min;

            @Override
            public boolean hasNext() {
                return current <= max;
            }

            @Override
            public Double next() {
                if (!hasNext()) {
                    throw new NoSuchElementException();
                }
                Double nextValue = current;
                current += increment;
                return nextValue;
            }
        };
    }

    @Override
    public Iterator<Double> iterator() {
        return new Iterator<Double>() {
            private Double current = min;

            @Override
            public boolean hasNext() {
                return current <= max;
            }

            @Override
            public Double next() {
                if (!hasNext()) {
                    throw new NoSuchElementException();
                }
                Double nextValue = current;
                current += increment;
                return nextValue;
            }
        };
    }

Replace Generic With Diamond Iterator<Double> with Iterator<> in method public iterator() : Iterator<Double> from class org.nanomodeller.XMLMappingFiles.Range


	public ServerLogger() {
		logs = new ArrayList<>();
	}

	public ServerLogger() {
		logs = new ArrayList<Object>();
	}

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method public ServerLogger() from class com.geosiris.webstudio.logs.ServerLogger


		public GetResourceRequest(String request) {
			from = null;
			depth = 1;
			where = new HashMap<>();

			Matcher m0 = p_from.matcher(request);
			if(m0.find()) {
				from = m0.group(1);
			}

			Matcher m1 = p_where.matcher(request);
			while (m1.find()) {
				Matcher m1_b = p_where_attributes.matcher(m1.group(1));
				while (m1_b.find()) {
					where.put(m1_b.group(1), m1_b.group(2));
				}
			}

			Matcher m2 = p_depth.matcher(request);
			if(m2.find()) {
				depth = Integer.parseInt(m2.group(1));
			}
		}

		public GetResourceRequest(String request) {
			from = null;
			depth = 1;
			where = new HashMap<String, String>();

			Matcher m0 = p_from.matcher(request);
			if(m0.find()) {
				from = m0.group(1);
			}

			Matcher m1 = p_where.matcher(request);
			while (m1.find()) {
				Matcher m1_b = p_where_attributes.matcher(m1.group(1));
				while (m1_b.find()) {
					where.put(m1_b.group(1), m1_b.group(2));
				}
			}

			Matcher m2 = p_depth.matcher(request);
			if(m2.find()) {
				depth = Integer.parseInt(m2.group(1));
			}
		}

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public GetResourceRequest(request String) from class com.geosiris.webstudio.servlet.GetResources.GetResourceRequest


	public static void main(String[] argv) {
		String request = "from(UUID-95aze-a555zea-aze)&where(#type=int.*, .kind=project, citation.Title =JeanFrançois Rainaud)&depth(2)";

		logger.info(new GetResourceRequest(request));

		Pattern p_type = Pattern.compile("TriangulatedSetRepresentation");
		Matcher m = p_type.matcher("TriangulatedSetRepresentation");
		if(m.find()) {
			logger.info("true");
		}else {
			logger.info("false");
		}

		String request2 = "from()&where(#type=[iI]nt.*, .kind=project, citation.Title =JeanFrançois Rainaud)&depth(2)";
		Map<String, Object> objectList = new HashMap<>();
		objectList.put("UUID-95aze-a555zea-aze", 3);
		objectList.put("UUID-95aze-a555zeae", 3.2);
		GetResourceRequest resq = new GetResourceRequest(request2);
		processRequest(objectList, resq );

	}

	public static void main(String[] argv) {
		String request = "from(UUID-95aze-a555zea-aze)&where(#type=int.*, .kind=project, citation.Title =JeanFrançois Rainaud)&depth(2)";

		logger.info(new GetResourceRequest(request));

		Pattern p_type = Pattern.compile("TriangulatedSetRepresentation");
		Matcher m = p_type.matcher("TriangulatedSetRepresentation");
		if(m.find()) {
			logger.info("true");
		}else {
			logger.info("false");
		}

		String request2 = "from()&where(#type=[iI]nt.*, .kind=project, citation.Title =JeanFrançois Rainaud)&depth(2)";
		Map<String, Object> objectList = new HashMap<String, Object>();
		objectList.put("UUID-95aze-a555zea-aze", 3);
		objectList.put("UUID-95aze-a555zeae", 3.2);
		GetResourceRequest resq = new GetResourceRequest(request2);
		processRequest(objectList, resq );

	}

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method public main(argv String[]) : void from class com.geosiris.webstudio.servlet.GetResources


	public static void sendfileWithPostRequest_NoFileName(
			HttpSession session,
			List<String> filesContent,
			String _url, String login, String pwd,
			String fileParamName, HashMap<String, String> otherParams) {
		sendfileWithPostRequest(session, filesContent.stream().map(x -> new Pair<>("fileName", x)).collect(Collectors.toList()),
				_url, login, pwd,
				fileParamName, otherParams);
	}

	public static void sendfileWithPostRequest_NoFileName(
			HttpSession session,
			List<String> filesContent,
			String _url, String login, String pwd,
			String fileParamName, HashMap<String, String> otherParams) {
		sendfileWithPostRequest(session, filesContent.stream().map(x -> new Pair<String, String>("fileName", x)).collect(Collectors.toList()),
				_url, login, pwd,
				fileParamName, otherParams);
	}

Replace Generic With Diamond Pair<String,String> with Pair<> in method public sendfileWithPostRequest_NoFileName(session HttpSession, filesContent List<String>, _url String, login String, pwd String, fileParamName String, otherParams HashMap<String,String>) : void from class com.geosiris.webstudio.utils.HttpSender


    public ObjectTree(String _name, Object _data, Class<?> _dataClass, ObjectTree parent, Boolean isMandatory) {
        name = _name;
        data = _data;

        this.isMandatory = isMandatory;
        dataClass = (data != null) ? data.getClass() : _dataClass;

        // Malheureusement on ne peut pas determiner les template directement il faut
        // regarder la declaration
        // dans la classe mere : cf @appendChildren et @appendProperty
        dataClassTemplatedList = new ArrayList<>();
        this.parent = parent;
        attributes = new ArrayList<>();
        properties = new ArrayList<>();
    }

    public ObjectTree(String _name, Object _data, Class<?> _dataClass, ObjectTree parent, Boolean isMandatory) {
        name = _name;
        data = _data;

        this.isMandatory = isMandatory;
        dataClass = (data != null) ? data.getClass() : _dataClass;

        // Malheureusement on ne peut pas determiner les template directement il faut
        // regarder la declaration
        // dans la classe mere : cf @appendChildren et @appendProperty
        dataClassTemplatedList = new ArrayList<Class<?>>();
        this.parent = parent;
        attributes = new ArrayList<>();
        properties = new ArrayList<>();
    }

Replace Generic With Diamond ArrayList<Class<?>> with ArrayList<> in method public ObjectTree(_name String, _data Object, _dataClass Class<?>, parent ObjectTree, isMandatory Boolean) from class com.geosiris.webstudio.utils.ObjectTree


    private static List<LogMessage> verifyReferencedDOR(
            ObjectTree objTree,
            String rootUUID,
            String rootCitationTitle,
            String rootType,
            Map<String, Object> resqmlObjects) {

        final List<ObjectTree> referencedDOR = objTree.filterListByObjectType("DataObjectReference", false, true);

        return referencedDOR.parallelStream().map( (dor) -> {
            List<LogMessage> messages = new ArrayList<>();
            Object refUuid = dor.getData("uuid");
            if (refUuid != null) {
                String rootTitle = objTree.getData("Citation.Title") + "";

                if (!resqmlObjects.containsKey(refUuid)) {
                    // On a pas trouve dans les objects du workspace, on cherche dans les objets
                    // pre-charges:
                    boolean foundInAdditional = false;
                    if (GetAdditionalObjects.ADDITIONAL_ENERGYML_OBJECTS != null) {
                        for (String uuid : GetAdditionalObjects.ADDITIONAL_ENERGYML_OBJECTS.keySet()) {
                            if (foundInAdditional || uuid.compareTo(refUuid + "") == 0) {
                                foundInAdditional = true;
                                break;
                            } else {
                                // On cherche dans l'objet si c'est un dictionary
                                Object additionalObj = GetAdditionalObjects.ADDITIONAL_ENERGYML_OBJECTS.get(uuid);
                                if (additionalObj.getClass().getSimpleName().toLowerCase().endsWith("dictionary")) {
                                    for (Method method : additionalObj.getClass().getMethods()) {
                                        // logger.info("[ADDITIONAL Object] method " + method.getName()
                                        // + " returns : " + method.getReturnType());
                                        if (Collection.class.isAssignableFrom(method.getReturnType())) {
                                            // C'est une collection
                                            try {
                                                Collection<?> collect = (Collection<?>) method.invoke(additionalObj);
                                                for (Object c_obj : collect) {
                                                    // .ObjectController.getObjectAttributeValue(c_obj, "Uuid"));
                                                    if (EPCGenericManager.isRootClass(c_obj.getClass())) {
                                                        String c_obj_uuid = (String) ObjectController.getObjectAttributeValue(c_obj, "Uuid");
                                                        if (c_obj_uuid.compareTo(refUuid + "") == 0) {
                                                            foundInAdditional = true;
                                                            break;
                                                        }
                                                    }
                                                }
                                            } catch (IllegalAccessException | IllegalArgumentException
                                                     | InvocationTargetException e) {
                                                logger.error(e.getMessage(), e);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (!foundInAdditional) {
                        messages.add(new LogResqmlVerification("DOR reference missing",
                                "Object is referencing an unkown uuid with value " + refUuid
                                        + " sub object is at path : " + dor.getName() + " and supposed title is '"
                                        + dor.getData("title") + "'",
                                rootUUID,
                                rootTitle,
                                rootType,
                                ServerLogMessage.MessageType.INFO));
                    }
                } else {
                    Object referencedObj = resqmlObjects.get(refUuid);
                    String refObjTitle = (String) ObjectController.getObjectAttributeValue(referencedObj, "Citation.Title");
                    String refObjContentType = EPCGenericManager.getObjectContentType(referencedObj, true);
                    String refObjQualifiedType = EPCGenericManager.getObjectQualifiedType(referencedObj, true);

                    String title = (String) dor.getData("title");
                    try {
                        String contentType = (String) dor.getData("contenttype");
                        String qualifiedType = (String) dor.getData("qualifiedType");
                        if (contentType == null && qualifiedType == null) {
                            messages.add(new LogResqmlVerification("DOR reference has wrong information",
                                    "Empty contentType/qualifiedType for DOR at path : " + dor.getName(),
                                    rootUUID,
                                    rootTitle,
                                    rootType,
                                    ServerLogMessage.MessageType.WARNING));
                        } else {
                            if (contentType != null && contentType.compareTo(refObjContentType) != 0) {
                                messages.add(new LogResqmlVerification("DOR reference has wrong information",
                                        "Referenced object content type should be '" + refObjContentType + "' and not '"
                                                + contentType + "' at path : " + dor.getName(),
                                        rootUUID,
                                        rootTitle,
                                        rootType,
                                        ServerLogMessage.MessageType.WARNING));
                            }else if (qualifiedType != null && qualifiedType.compareTo(refObjQualifiedType) != 0) {
                                messages.add(new LogResqmlVerification("DOR reference has wrong information",
                                        "Referenced object content type should be '" + refObjQualifiedType + "' and not '"
                                                + qualifiedType + "' at path : " + dor.getName(),
                                        rootUUID,
                                        rootTitle,
                                        rootType,
                                        ServerLogMessage.MessageType.WARNING));
                            }
                            if (refObjTitle.compareTo(title) != 0) {
                                messages.add(new LogResqmlVerification("DOR reference has wrong information",
                                        "Referenced object title is '" + refObjTitle + "' and not '" + title
                                                + "' at path : " + dor.getName(),
                                        rootUUID,
                                        rootTitle,
                                        rootType,
                                        ServerLogMessage.MessageType.WARNING));
                            }

                        }
                    } catch (Exception e) {
                        logger.error(e.getMessage(), e);
                    }
                }
            }
            return messages;
        }).flatMap(List::stream).collect(Collectors.toList());
    }

    private static List<LogMessage> verifyReferencedDOR(
            ObjectTree objTree,
            String rootUUID,
            String rootCitationTitle,
            String rootType,
            Map<String, Object> resqmlObjects) {

        final List<ObjectTree> referencedDOR = objTree.filterListByObjectType("DataObjectReference", false, true);

        return referencedDOR.parallelStream().map( (dor) -> {
            List<LogMessage> messages = new ArrayList<LogMessage>();
            Object refUuid = dor.getData("uuid");
            if (refUuid != null) {
                String rootTitle = objTree.getData("Citation.Title") + "";

                if (!resqmlObjects.containsKey(refUuid)) {
                    // On a pas trouve dans les objects du workspace, on cherche dans les objets
                    // pre-charges:
                    boolean foundInAdditional = false;
                    if (GetAdditionalObjects.ADDITIONAL_ENERGYML_OBJECTS != null) {
                        for (String uuid : GetAdditionalObjects.ADDITIONAL_ENERGYML_OBJECTS.keySet()) {
                            if (foundInAdditional || uuid.compareTo(refUuid + "") == 0) {
                                foundInAdditional = true;
                                break;
                            } else {
                                // On cherche dans l'objet si c'est un dictionary
                                Object additionalObj = GetAdditionalObjects.ADDITIONAL_ENERGYML_OBJECTS.get(uuid);
                                if (additionalObj.getClass().getSimpleName().toLowerCase().endsWith("dictionary")) {
                                    for (Method method : additionalObj.getClass().getMethods()) {
                                        // logger.info("[ADDITIONAL Object] method " + method.getName()
                                        // + " returns : " + method.getReturnType());
                                        if (Collection.class.isAssignableFrom(method.getReturnType())) {
                                            // C'est une collection
                                            try {
                                                Collection<?> collect = (Collection<?>) method.invoke(additionalObj);
                                                for (Object c_obj : collect) {
                                                    // .ObjectController.getObjectAttributeValue(c_obj, "Uuid"));
                                                    if (EPCGenericManager.isRootClass(c_obj.getClass())) {
                                                        String c_obj_uuid = (String) ObjectController.getObjectAttributeValue(c_obj, "Uuid");
                                                        if (c_obj_uuid.compareTo(refUuid + "") == 0) {
                                                            foundInAdditional = true;
                                                            break;
                                                        }
                                                    }
                                                }
                                            } catch (IllegalAccessException | IllegalArgumentException
                                                     | InvocationTargetException e) {
                                                logger.error(e.getMessage(), e);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (!foundInAdditional) {
                        messages.add(new LogResqmlVerification("DOR reference missing",
                                "Object is referencing an unkown uuid with value " + refUuid
                                        + " sub object is at path : " + dor.getName() + " and supposed title is '"
                                        + dor.getData("title") + "'",
                                rootUUID,
                                rootTitle,
                                rootType,
                                ServerLogMessage.MessageType.INFO));
                    }
                } else {
                    Object referencedObj = resqmlObjects.get(refUuid);
                    String refObjTitle = (String) ObjectController.getObjectAttributeValue(referencedObj, "Citation.Title");
                    String refObjContentType = EPCGenericManager.getObjectContentType(referencedObj, true);
                    String refObjQualifiedType = EPCGenericManager.getObjectQualifiedType(referencedObj, true);

                    String title = (String) dor.getData("title");
                    try {
                        String contentType = (String) dor.getData("contenttype");
                        String qualifiedType = (String) dor.getData("qualifiedType");
                        if (contentType == null && qualifiedType == null) {
                            messages.add(new LogResqmlVerification("DOR reference has wrong information",
                                    "Empty contentType/qualifiedType for DOR at path : " + dor.getName(),
                                    rootUUID,
                                    rootTitle,
                                    rootType,
                                    ServerLogMessage.MessageType.WARNING));
                        } else {
                            if (contentType != null && contentType.compareTo(refObjContentType) != 0) {
                                messages.add(new LogResqmlVerification("DOR reference has wrong information",
                                        "Referenced object content type should be '" + refObjContentType + "' and not '"
                                                + contentType + "' at path : " + dor.getName(),
                                        rootUUID,
                                        rootTitle,
                                        rootType,
                                        ServerLogMessage.MessageType.WARNING));
                            }else if (qualifiedType != null && qualifiedType.compareTo(refObjQualifiedType) != 0) {
                                messages.add(new LogResqmlVerification("DOR reference has wrong information",
                                        "Referenced object content type should be '" + refObjQualifiedType + "' and not '"
                                                + qualifiedType + "' at path : " + dor.getName(),
                                        rootUUID,
                                        rootTitle,
                                        rootType,
                                        ServerLogMessage.MessageType.WARNING));
                            }
                            if (refObjTitle.compareTo(title) != 0) {
                                messages.add(new LogResqmlVerification("DOR reference has wrong information",
                                        "Referenced object title is '" + refObjTitle + "' and not '" + title
                                                + "' at path : " + dor.getName(),
                                        rootUUID,
                                        rootTitle,
                                        rootType,
                                        ServerLogMessage.MessageType.WARNING));
                            }

                        }
                    } catch (Exception e) {
                        logger.error(e.getMessage(), e);
                    }
                }
            }
            return messages;
        }).flatMap(List::stream).collect(Collectors.toList());
    }

Replace Generic With Diamond ArrayList<LogMessage> with ArrayList<> in method private verifyReferencedDOR(objTree ObjectTree, rootUUID String, rootCitationTitle String, rootType String, resqmlObjects Map<String,Object>) : List<LogMessage> from class com.geosiris.webstudio.utils.ResqmlVerification


    public static List<LogResqmlVerification> doRemoveVersionString(Map<String, Object> resqmlObjects) {
        List<LogResqmlVerification> messages = new ArrayList<>();

        for (String rootUUID : resqmlObjects.keySet()) {
            messages.addAll(doRemoveVersionString(rootUUID, resqmlObjects));
        }
        return messages;
    }

    public static List<LogResqmlVerification> doRemoveVersionString(Map<String, Object> resqmlObjects) {
        List<LogResqmlVerification> messages = new ArrayList<LogResqmlVerification>();

        for (String rootUUID : resqmlObjects.keySet()) {
            messages.addAll(doRemoveVersionString(rootUUID, resqmlObjects));
        }
        return messages;
    }

Replace Generic With Diamond ArrayList<LogResqmlVerification> with ArrayList<> in method public doRemoveVersionString(resqmlObjects Map<String,Object>) : List<LogResqmlVerification> from class com.geosiris.webstudio.utils.ResqmlVerification


    public static List<LogResqmlVerification> doCorrection(Map<String, Object> resqmlObjects) {
        List<LogResqmlVerification> messages = new ArrayList<>();

        for (String rootUUID : resqmlObjects.keySet()) {
            messages.addAll(doCorrection(rootUUID, resqmlObjects));
        }
        return messages;
    }

    public static List<LogResqmlVerification> doCorrection(Map<String, Object> resqmlObjects) {
        List<LogResqmlVerification> messages = new ArrayList<LogResqmlVerification>();

        for (String rootUUID : resqmlObjects.keySet()) {
            messages.addAll(doCorrection(rootUUID, resqmlObjects));
        }
        return messages;
    }

Replace Generic With Diamond ArrayList<LogResqmlVerification> with ArrayList<> in method public doCorrection(resqmlObjects Map<String,Object>) : List<LogResqmlVerification> from class com.geosiris.webstudio.utils.ResqmlVerification


    public static List<LogResqmlVerification> doCorrection(String objUUID, Map<String, Object> resqmlObjects) {
        List<LogResqmlVerification> messages = new ArrayList<>();
        if(resqmlObjects.containsKey(objUUID)){
            return correctDORInformation(resqmlObjects.get(objUUID), resqmlObjects);
        }
        return messages;
    }

    public static List<LogResqmlVerification> doCorrection(String objUUID, Map<String, Object> resqmlObjects) {
        List<LogResqmlVerification> messages = new ArrayList<LogResqmlVerification>();
        if(resqmlObjects.containsKey(objUUID)){
            return correctDORInformation(resqmlObjects.get(objUUID), resqmlObjects);
        }
        return messages;
    }

Replace Generic With Diamond ArrayList<LogResqmlVerification> with ArrayList<> in method public doCorrection(objUUID String, resqmlObjects Map<String,Object>) : List<LogResqmlVerification> from class com.geosiris.webstudio.utils.ResqmlVerification


    public static List<LogResqmlVerification> doCorrectSchemaVersion(Map<String, Object> resqmlObjects) {
        List<LogResqmlVerification> messages = new ArrayList<>();

        for (String rootUUID : resqmlObjects.keySet()) {
            messages.addAll(doCorrectSchemaVersion(rootUUID, resqmlObjects));
        }
        return messages;
    }

    public static List<LogResqmlVerification> doCorrectSchemaVersion(Map<String, Object> resqmlObjects) {
        List<LogResqmlVerification> messages = new ArrayList<LogResqmlVerification>();

        for (String rootUUID : resqmlObjects.keySet()) {
            messages.addAll(doCorrectSchemaVersion(rootUUID, resqmlObjects));
        }
        return messages;
    }

Replace Generic With Diamond ArrayList<LogResqmlVerification> with ArrayList<> in method public doCorrectSchemaVersion(resqmlObjects Map<String,Object>) : List<LogResqmlVerification> from class com.geosiris.webstudio.utils.ResqmlVerification


  public static void main(String[] args) throws InterruptedException, IOException {
    if (args.length != 2 || !"--directory".equals(args[0])) {
      throw new IllegalArgumentException("Usage: --directory <absolute path to directory to retrieve files from>");
    }

    Path directoryPath = Paths.get(args[1]);
    if (!directoryPath.isAbsolute()) {
      System.err.println("Error: Directory path must be absolute");
      throw new IllegalArgumentException("Usage: --directory <absolute path to directory to retrieve files from>");
    }

    try (ServerSocket serverSocket = new ServerSocket(4221);
        ExecutorService executorService = Executors.newVirtualThreadPerTaskExecutor()) {
      while (true) {
        Socket clientSocket = serverSocket.accept(); // Wait for connection from client.

        executorService.submit(() -> {
          try (
              InputStream inputStream = clientSocket.getInputStream();
              OutputStream outputStream = clientSocket.getOutputStream()) {
            serverSocket.setReuseAddress(true);

            // handle incoming connection
            HttpRequest request = HttpRequest.readFrom(inputStream);

            String response = switch (request.getPath()) {
              case "/" -> HTTP_OK;
              case String path when path.startsWith(PATH_ECHO) -> buildTextResponse(path.split("/")[2]);
              case String path when path.startsWith(PATH_USER_AGENT) ->
                buildTextResponse(request.getHeader("User-Agent"));
              case String path when path.startsWith(PATH_FILES) -> {
                try {
                  Path filePath = directoryPath.resolve(path.substring(7));
                  byte[] fileContent = Files.readAllBytes(filePath);

                  yield buildResponse(new String(fileContent, StandardCharsets.UTF_8), "application/octet-stream",
                      fileContent.length);
                } catch (IOException e) {
                  System.err.println(e.getMessage());

                  yield HTTP_NOT_FOUND;
                }
              }
              default -> HTTP_NOT_FOUND;
            };

            outputStream.write(response.getBytes());
          } catch (IOException | IllegalArgumentException e) {
            e.printStackTrace();
          }
        });
      }
    }
  }

  public static void main(String[] args) throws InterruptedException, IOException {
    ServerSocket serverSocket = new ServerSocket(4221);

    try {
      while (true) {
        Socket clientSocket = serverSocket.accept(); // Wait for connection from client.

        executorService.submit(() -> {
          try (
              InputStream inputStream = clientSocket.getInputStream();
              OutputStream outputStream = clientSocket.getOutputStream()) {
            serverSocket.setReuseAddress(true);

            // handle incoming connection
            HttpRequest request = HttpRequest.readFrom(inputStream);

            String response = switch (request.getPath()) {
              case "/" -> HTTP_OK;
              case String path when path.startsWith("/echo") -> buildTextResponse(path.split("/")[2]);
              case String path when path.startsWith("/user-agent") ->
                buildTextResponse(request.getHeader("User-Agent"));
              default -> HTTP_NOT_FOUND;
            };

            outputStream.write(response.getBytes());
          } catch (IOException | IllegalArgumentException e) {
            e.printStackTrace();
          }
        });
      }
    } finally {
      executorService.shutdown();
      serverSocket.close();
    }
  }

Try With Resources try(ServerSocket serverSocket=new ServerSocket(4221); ExecutorService executorService=Executors.newVirtualThreadPerTaskExecutor()) in method public main(args String[]) : void from class Main


  public static void main(String[] args) throws InterruptedException {
    try (
        ServerSocket serverSocket = new ServerSocket(4221);
        Socket clientSocket = serverSocket.accept(); // Wait for connection from client.
        InputStream inputStream = clientSocket.getInputStream();
        OutputStream outputStream = clientSocket.getOutputStream()) {
      serverSocket.setReuseAddress(true);

      System.out.println("accepted new connection");
      // handle incoming connection
      Request request = Request.readFrom(inputStream);
      System.out.println(request.getPath());
      System.out.println(request.getHttpMethod());
      System.out.println(request.getHttpVersion());

      System.out.println("sending response...");
      if ("/".equals(request.getPath())) {
        outputStream.write(HTTP_OK.getBytes());
      } else {
        outputStream.write(HTTP_NOT_FOUND.getBytes());
      }

      System.out.println("wrote bytes to socket");
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

  public static void main(String[] args) {
    ServerSocket serverSocket = null;
    Socket clientSocket = null;

    try {
      serverSocket = new ServerSocket(4221);
      serverSocket.setReuseAddress(true);
      clientSocket = serverSocket.accept(); // Wait for connection from client.

      System.out.println("accepted new connection");
      // handle incoming connection
      // var inputStream = clientSocket.getInputStream();
      // var request = readRequest(inputStream);
      // System.out.println(request);

      System.out.println("sending response...");
      try (var outputStream = clientSocket.getOutputStream()) {
        System.out.println("writing bytes to socket...");
        outputStream.write(HTTP_OK.getBytes());
        System.out.println("wrote bytes to socket");
        outputStream.flush();
        outputStream.close();
      }

      serverSocket.close();
      clientSocket.close();
    } catch (IOException e) {
      System.out.println("IOException: " + e.getMessage());
    }
  }

Try With Resources try(ServerSocket serverSocket=new ServerSocket(4221); Socket clientSocket=serverSocket.accept(); InputStream inputStream=clientSocket.getInputStream(); OutputStream outputStream=clientSocket.getOutputStream()) in method public main(args String[]) : void from class Main


  @Override
  public User registerRequestDTOToUser(RegisterRequestDTO registerRequestDTO) {
    var user = userMapper.registerRequestDTOToUser(registerRequestDTO);
    user.setPassword(passwordEncoder.encode(user.getPassword()));
    List<Role> roles = new ArrayList<>();
    roles.add(roleService.getBasicUserRole());
    user.setRoles(roles);
    return user;
  }

  @Override
  public User registerRequestDTOToUser(RegisterRequestDTO registerRequestDTO) {
    var user = userMapper.registerRequestDTOToUser(registerRequestDTO);
    user.setPassword(passwordEncoder.encode(user.getPassword()));
    var roles = new ArrayList<Role>();
    roles.add(roleService.getBasicUserRole());
    user.setRoles(roles);
    return user;
  }

Replace Generic With Diamond ArrayList<Role> with ArrayList<> in method public registerRequestDTOToUser(registerRequestDTO RegisterRequestDTO) : User from class ru.skillbox.zerone.backend.mapstruct.UserMapperDecorator


    public void addCompleter(String label, Method m, Object obj) {
        completers.put(label, new AbstractMap.SimpleEntry<>(m, obj));
    }

    public void addCompleter(String label, Method m, Object obj) {
        completers.put(label, new AbstractMap.SimpleEntry<Method, Object>(m, obj));
    }

Replace Generic With Diamond AbstractMap.SimpleEntry<Method,Object> with AbstractMap.SimpleEntry<> in method public addCompleter(label String, m Method, obj Object) : void from class gym.core.utils.command.BukkitCompleter


	public RankManager(final Core main) {
		this.main = main;
		this.ranks = Maps.newHashMap();
		this.deletedRank = new ArrayList<>();
	}

	public RankManager(final Core main) {
		this.main = main;
		this.ranks = Maps.newHashMap();
		this.deletedRank = new ArrayList<String>();
	}

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public RankManager(main Core) from class gym.core.handler.manager.RankManager


    public void buttonAndAction(){
        JButton managementActivities = new JButton("Management Activities ");
        managementActivities.setBounds(HEIGHT_BUTTON,HEIGHT_BUTTON,WIDTH_BUTTON,HEIGHT_BUTTON);
        managementActivities.setVisible(true);
        managementActivities.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.out.println("Management Activities");
                //addManagementActivities();
                window.managementActivities();
            }

        });
        JButton userStatistics = new JButton("User Statistics ");
        userStatistics.setBounds(HEIGHT_BUTTON,managementActivities.getY()+HEIGHT_BUTTON+DELTA,WIDTH_BUTTON,HEIGHT_BUTTON);
        userStatistics.setVisible(true);
        userStatistics.addActionListener(e -> {
            System.out.println("User Statistics");
            window.userStatistic();

        });

        JButton activityHistory = new JButton("Activity history ");
        activityHistory.setBounds(HEIGHT_BUTTON,userStatistics.getY()+HEIGHT_BUTTON+DELTA,WIDTH_BUTTON,HEIGHT_BUTTON);
        activityHistory.setVisible(true);
        activityHistory.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.out.println("Activity history");
                window.activityHistory();

            }
        });
        JButton graph = new JButton("graph ");
        graph.setBounds(HEIGHT_BUTTON,activityHistory.getY()+HEIGHT_BUTTON+DELTA,WIDTH_BUTTON,HEIGHT_BUTTON);
        graph.setVisible(true);
        graph.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.out.println(" graph");
                window.graph();
            }
        });
        this.add(managementActivities);
        this.add(userStatistics);
        this.add(activityHistory);
        this.add(graph);
    }

    public void buttonAndAction(){
        JButton managementActivities = new JButton("Management Activities ");
        managementActivities.setBounds(HEIGHT_BUTTON,HEIGHT_BUTTON,WIDTH_BUTTON,HEIGHT_BUTTON);
        managementActivities.setVisible(true);
        managementActivities.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.out.println("Management Activities");
                //addManagementActivities();
                window.managementActivities();
            }

        });
        JButton userStatistics = new JButton("User Statistics ");
        userStatistics.setBounds(HEIGHT_BUTTON,managementActivities.getY()+HEIGHT_BUTTON+DELTA,WIDTH_BUTTON,HEIGHT_BUTTON);
        userStatistics.setVisible(true);
        userStatistics.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.out.println("User Statistics");
                window.userStatistic();
            }
        });

        JButton activityHistory = new JButton("Activity history ");
        activityHistory.setBounds(HEIGHT_BUTTON,userStatistics.getY()+HEIGHT_BUTTON+DELTA,WIDTH_BUTTON,HEIGHT_BUTTON);
        activityHistory.setVisible(true);
        activityHistory.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.out.println("Activity history");
                window.activityHistory();

            }
        });
        JButton graph = new JButton("graph ");
        graph.setBounds(HEIGHT_BUTTON,activityHistory.getY()+HEIGHT_BUTTON+DELTA,WIDTH_BUTTON,HEIGHT_BUTTON);
        graph.setVisible(true);
        graph.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.out.println(" graph");
                window.graph();
            }
        });
        this.add(managementActivities);
        this.add(userStatistics);
        this.add(activityHistory);
        this.add(graph);
    }

Replace Anonymous With Lambda org.example.Panel.buttonAndAction.addActionListener.new ActionListener with e -> {System.out.println("User Statistics"); in method public buttonAndAction() : void from class org.example.Panel


    private JToggleButton createButton(String name) {
        JToggleButton button = new JToggleButton(name);
        button.addActionListener(e -> {
            if (button.isSelected()) {
                if (currentSelectionCount < maxSelectionCount) {
                    // Button pressed action
                    InlineKeyboardButton numbersButton = new InlineKeyboardButton(button.getText()); // בניית כפתור
                    numbersButton.setCallbackData(button.getText());
                    telegramButtonList.add(numbersButton);

                    currentSelectionCount++;
                    // Perform action when button is pressed
                    System.out.println(button.getText() + " pressed");
                    telegramButtonList.forEach(System.out::println);

                } else {
                    button.setSelected(false); // Deselect the button if maximum selection count is reached
                }
            } else {
                // Button unpressed action
                currentSelectionCount--;
                // Perform action when button is unpressed

                Iterator<InlineKeyboardButton> iterator = telegramButtonList.iterator();
                while (iterator.hasNext()) {
                    InlineKeyboardButton telegramButton = iterator.next();
                    if (button.getText().equals(telegramButton.getText())) {
                        iterator.remove();
                    }
                }
                System.out.println(button.getText() + " unpressed");
                telegramButtonList.forEach(System.out::println);
            }
        });
        buttons.add(button);
        return button;
    }

    private JToggleButton createButton(String name) {
        JToggleButton button = new JToggleButton(name);
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (button.isSelected()) {
                    if (currentSelectionCount < maxSelectionCount) {
                        // Button pressed action
                        //createButtonInTelegram(button.getText)
                        InlineKeyboardButton numbersButton = new InlineKeyboardButton(button.getText()); // בניית כפתור
                        numbersButton.setCallbackData(button.getText());
                        telegramButtonList.add(numbersButton);

                        currentSelectionCount++;
                        // Perform action when button is pressed
                        System.out.println(button.getText() + " pressed");
                        telegramButtonList.forEach(System.out::println);

                    } else {
                        button.setSelected(false); // Deselect the button if maximum selection count is reached
                    }
                } else {
                    // Button unpressed action
                    currentSelectionCount--;
                    // Perform action when button is unpressed
//                    for(InlineKeyboardButton telegramButtons : telegramButtonList){
//                        if(button.getText().equals(telegramButtons.getText())){
//                            telegramButtonList.remove(telegramButtons);
//                        }
//                    }
                    Iterator<InlineKeyboardButton> iterator = telegramButtonList.iterator();
                    while (iterator.hasNext()) {
                        InlineKeyboardButton telegramButton = iterator.next();
                        if (button.getText().equals(telegramButton.getText())) {
                            iterator.remove();
                        }
                    }
                    System.out.println(button.getText() + " unpressed");
                    telegramButtonList.forEach(System.out::println);

                }
            }
        });
        buttons.add(button);
        return button;
    }

Replace Anonymous With Lambda org.example.ManagementActivities.createButton.addActionListener.new ActionListener with e -> {if(button.isSelected()){if(currentSelectionCount < maxSelectionCount){InlineKeyboardButton numbersButton=new InlineKeyboardButton(button.getText()); in method private createButton(name String) : JToggleButton from class org.example.ManagementActivities


    public void insert(T data){
        BTreeNode<T> s;
        if (root == null){
            root = new BTreeNode<>(d);
        }
        if (root.leaf){
            s = root.insertLeaf(data, comparator);
            if (s != null){
                BTreeNode<T> tmp = root;
                root = new BTreeNode<>(d, tmp, s, tmp.K[d]);
                tmp.K[d] = null;
            }
        } else {
            s = root.insertNode(data, comparator, true);
            if (s != null){
                root = s;
            }
        }
    }

    public void insert(T data){
        BTreeNode<T> s;
        if (root == null){
            root = new BTreeNode<T>(d);
        }
        if (root.leaf){
            s = root.insertLeaf(data, comparator);
            if (s != null){
                BTreeNode<T> tmp = root;
                root = new BTreeNode<>(d, tmp, s, tmp.K[d]);
                tmp.K[d] = null;
            }
        } else {
            s = root.insertNode(data, comparator, true);
            if (s != null){
                root = s;
            }
        }
    }

Replace Generic With Diamond BTreeNode<T> with BTreeNode<> in method public insert(data T) : void from class DataStructure.Tree.BTree


    public BTreeNode<T> insertNode(T value, Comparator<T> comparator, boolean isRoot){
        BTreeNode<T> s, newNode;
        int child;
        child = position(value, comparator);
        if (!children[child].leaf){
            s = children[child].insertNode(value, comparator, false);
        } else {
            s = children[child].insertLeaf(value, comparator);
        }
        if (s == null){
            return null;
        }
        insertIntoK(child, children[child].K[d]);
        children[child].K[d] = null;
        if (m < 2 * d){
            children[child + 1] = s;
            m++;
            return null;
        } else {
            newNode = new BTreeNode<>(d);
            newNode.leaf = false;
            moveHalfOfTheElementsToNewNode(newNode);
            newNode.children[d] = s;
            m = d;
            if (isRoot){
                BTreeNode<T> a = new BTreeNode<>(d, this, newNode, this.K[d]);
                this.K[d] = null;
                return a;
            } else {
                return newNode;
            }
        }
    }

    public BTreeNode<T> insertNode(T value, Comparator<T> comparator, boolean isRoot){
        BTreeNode<T> s, newNode;
        int child;
        child = position(value, comparator);
        if (!children[child].leaf){
            s = children[child].insertNode(value, comparator, false);
        } else {
            s = children[child].insertLeaf(value, comparator);
        }
        if (s == null){
            return null;
        }
        insertIntoK(child, children[child].K[d]);
        children[child].K[d] = null;
        if (m < 2 * d){
            children[child + 1] = s;
            m++;
            return null;
        } else {
            newNode = new BTreeNode<>(d);
            newNode.leaf = false;
            moveHalfOfTheElementsToNewNode(newNode);
            newNode.children[d] = s;
            m = d;
            if (isRoot){
                BTreeNode<T> a = new BTreeNode<T>(d, this, newNode, this.K[d]);
                this.K[d] = null;
                return a;
            } else {
                return newNode;
            }
        }
    }

Replace Generic With Diamond BTreeNode<T> with BTreeNode<> in method public insertNode(value T, comparator Comparator<T>, isRoot boolean) : BTreeNode<T> from class DataStructure.Tree.BTreeNode


    public static void main(String[] args) {
//        args = "/GW/D5data-11/hvthinh/TABLEM/all/all+id.shuf.annotation.gz /GW/D5data-11/hvthinh/TABLEM/all/all+id.shuf.annotation+linking.gz 0,0,1,1,2,2,3,3 32".split("\\s++");

        System.out.println("Init clients");
        ScoringClientInterface client = new MultiThreadedDeepScoringClient(false, args[2]);

        System.out.println("Now processing.");
        PrintWriter out = FileUtils.getPrintWriter(args[1], "UTF-8");
        FileUtils.LineStream stream = FileUtils.getLineStream(args[0], "UTF-8");

        SelfMonitor m = new SelfMonitor(ColumnLinkingExecutor.class.getName(), -1, 60);
        m.start();

        Concurrent.runAndWait(() -> {
            Gson gson = new Gson();
            TaggingPipeline pipeline = TaggingPipeline.getColumnLinkingPipeline(client);

            String line;
            while (true) {
                synchronized (stream) {
                    line = stream.readLine();
                }
                if (line == null) {
                    return;
                }
                Table table = null;
                try {
                    table = gson.fromJson(line, Table.class);
                } catch (Exception e) {
                    System.err.println("ERROR: " + line);
                    continue;
                }
                if (pipeline.tag(table)) {
                    synchronized (out) {
                        out.println(gson.toJson(table));
                    }
                }
                m.incAndGet();
            }
        }, Integer.parseInt(args[3]));

        m.forceShutdown();
        out.close();

        System.exit(0);
    }

    public static void main(String[] args) {
//        args = "/GW/D5data-11/hvthinh/TABLEM/all/all+id.shuf.annotation.gz /GW/D5data-11/hvthinh/TABLEM/all/all+id.shuf.annotation+linking.gz 0,0,1,1,2,2,3,3 32".split("\\s++");

        System.out.println("Init clients");
        ScoringClientInterface client = new MultiThreadedDeepScoringClient(false, args[2]);

        System.out.println("Now processing.");
        PrintWriter out = FileUtils.getPrintWriter(args[1], "UTF-8");
        FileUtils.LineStream stream = FileUtils.getLineStream(args[0], "UTF-8");

        SelfMonitor m = new SelfMonitor(ColumnLinkingExecutor.class.getName(), -1, 60);
        m.start();

        Concurrent.runAndWait(new Runnable() {

            @Override
            public void run() {
                Gson gson = new Gson();
                TaggingPipeline pipeline = TaggingPipeline.getColumnLinkingPipeline(client);

                String line;
                while (true) {
                    synchronized (stream) {
                        line = stream.readLine();
                    }
                    if (line == null) {
                        return;
                    }
                    Table table = null;
                    try {
                        table = gson.fromJson(line, Table.class);
                    } catch (Exception e) {
                        System.err.println("ERROR: " + line);
                        continue;
                    }
                    if (pipeline.tag(table)) {
                        synchronized (out) {
                            out.println(gson.toJson(table));
                        }
                    }
                    m.incAndGet();
                }

            }
        }, Integer.parseInt(args[3]));

        m.forceShutdown();
        out.close();

        System.exit(0);
    }

Replace Anonymous With Lambda data.ColumnLinkingExecutor.main.runAndWait.new Runnable with () -> {Gson gson=new Gson(); in method public main(args String[]) : void from class data.ColumnLinkingExecutor


    /**
     * Execute the given files inside a single interpreter.
     *
     * @param files The filenames of the files that should be executed
     */
    public static void executeFiles(String[] files) {
        Interpreter interpreter = new Interpreter();
        for (String file : files) {
            Path path = Path.of(file);
            try {
                interpreter.execute(path);
            } catch (InterpreterException | ParsingException error) {
                System.err.println(error);
                break;
            }
        }
    }

    /**
     * Execute the given files inside a single interpreter.
     *
     * @param files The filenames of the files that should be executed
     */
    public static void executeFiles(String[] files) {
        Interpreter interpreter = new Interpreter();
        for (String file : files) {
            Path path = Path.of(file);
            try {
                interpreter.execute(path);
            } catch (InterpreterException error) {
                printError("Runtime error", error.getPosition(), error.getMessage());
                break;
            } catch (ParsingException error) {
                printError("Syntax error", error.getPosition(), error.getMessage());
                break;
            }
        }
    }

Merge Catch [catch(InterpreterException error), catch(ParsingException error)] to catch(InterpreterException|ParsingException error) in method public executeFiles(files String[]) : void from class daro.lang.cli.Cli


    /**
     * The action triggered by pushing the button on the GUI
     */
    @FXML
    protected void startCamera() {
        // start the video capture
        this.capture.open(cameraId);

        // is the video stream available?
        if (this.capture.isOpened()) {
            // grab a frame every 33 ms (30 frames/sec)
            Runnable frameGrabber = () -> {
                    // effectively grab and process a single frame
                    Mat frame = grabFrame();

                    try {
                        this.counter += 33;
                        if (this.counter == 33*100) {
                            this.counter = 0;

                            this.updateAlertMsg(new FaceMaskDetection().detect(frame));
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }

                    // convert and show the frame
                    Image imageToShow = OpenCV.mat2Image(frame);
                    this.updateImageView(webCam, imageToShow);
            };

            this.timer = Executors.newSingleThreadScheduledExecutor();
            this.timer.scheduleAtFixedRate(frameGrabber, 0, 33, TimeUnit.MILLISECONDS);
        } else {
            // log the error
            System.err.println("Impossible to open the camera connection...");
        }
    }

    /**
     * The action triggered by pushing the button on the GUI
     */
    @FXML
    protected void startCamera() {
        // start the video capture
        this.capture.open(cameraId);

        // is the video stream available?
        if (this.capture.isOpened()) {
            this.cameraActive = true;

            // grab a frame every 20 ms (20 frames/sec)
            Runnable frameGrabber = new Runnable() {

                @Override
                public void run() {
                    // effectively grab and process a single frame
                    Mat frame = grabFrame();
                    frame = new FaceMaskDetection().detect(frame);
                    //frame = new FaceDetection(frame).detect().animateFrame().getFrame();

                    // convert and show the frame
                    Image imageToShow = OpenCV.mat2Image(frame);
                    updateImageView(webCam, imageToShow);
                }
            };

            this.timer = Executors.newSingleThreadScheduledExecutor();
            this.timer.scheduleAtFixedRate(frameGrabber, 0, 20, TimeUnit.MILLISECONDS);
        } else {
            // log the error
            System.err.println("Impossible to open the camera connection...");
        }
    }

Replace Anonymous With Lambda smartdoor.controllers.HomeController.startCamera.frameGrabber.new Runnable with () -> {Mat frame=grabFrame(); in method protected startCamera() : void from class smartdoor.controllers.HomeController


    public List<Patient> getAllPatients() {
        List<Patient> patientList = new ArrayList<>();
        try (Session session = HibernateSession.getSessionFactory().openSession()) {
            patientRepository.setSession(session);

            tx = session.beginTransaction();
            patientList = patientRepository.getAll();
            tx.commit();

        } catch (Exception e) {
            if (tx != null) {
                System.out.println("There is no patients !");
                tx.rollback();
                e.printStackTrace();
            }
        }

        return patientList;
    }

    public List<Patient> getAllPatients() {
        List<Patient> patientList = new ArrayList<>();
        try {
            getSession();
            patientRepository.setSession(session);

            tx = session.beginTransaction();
            patientList = patientRepository.getAll();
            tx.commit();
        } catch (Exception e) {
            if (tx!=null){
                System.out.println("There is no patients !");
                tx.rollback();
                e.printStackTrace();
            }
        }finally {
            closeSession();
        }
        return patientList;
    }

Try With Resources try(Session session=HibernateSession.getSessionFactory().openSession()) in method public getAllPatients() : List<Patient> from class com.consultations.patientsjee.service.PatientService


    public boolean addAPatient(Patient newPatient) {
        try (Session session = HibernateSession.getSessionFactory().openSession()){
            patientRepository.setSession(session);

            tx = session.beginTransaction();
            patientRepository.add(newPatient);
            tx.commit();
            return true;
        } catch (Exception e) {
            if (tx != null) {
                tx.rollback();
                e.printStackTrace();
            }
        }
        return false;
    }

    public boolean addAPatient(Patient newPatient) {
        tx = null;
        session = null;
        try {
            getSession();
            patientRepository.setSession(session);

            tx = session.beginTransaction();
            patientRepository.add(newPatient);
            tx.commit();
            return true;
        } catch (Exception e) {
            if (tx != null) {
                tx.rollback();
                e.printStackTrace();
            }
        } finally {
            closeSession();
        }
        return false;
    }

Try With Resources try(Session session=HibernateSession.getSessionFactory().openSession()) in method public addAPatient(newPatient Patient) : boolean from class com.consultations.patientsjee.service.PatientService


    public boolean deleteAPatient(long patientId) {
        try (Session session = HibernateSession.getSessionFactory().openSession()){
            patientRepository.setSession(session);
            Patient patientToFind = patientRepository.getById(patientId);
            if (patientToFind != null) {
                tx = session.beginTransaction();
                patientRepository.delete(patientToFind);
                tx.commit();
                return true;
            } else {
                return false;
            }
        } catch (Exception e) {
            if (tx != null) {
                tx.rollback();
                e.printStackTrace();
            }
        }
        return false;
    }

    public boolean deleteAPatient(long patientId) {
        tx = null;
        session = null;

        try {
            getSession();

            Patient patient = patientRepository.getById(patientId);
            if (patient != null) {
                tx = session.beginTransaction();
                patientRepository.delete(patient);
                tx.commit();
                return true;
            } else {
                return false;
            }
        } catch (Exception e) {
            if (tx != null) {
                tx.rollback();
                e.printStackTrace();
            }
        } finally {
            closeSession();
        }
        return false;
    }

Try With Resources try(Session session=HibernateSession.getSessionFactory().openSession()) in method public deleteAPatient(patientId long) : boolean from class com.consultations.patientsjee.service.PatientService


    public boolean updateAPatient(long patientId, Patient updatedPatient) {
        try (Session session = HibernateSession.getSessionFactory().openSession()) {
            patientRepository.setSession(session);

            Patient patientToUpdate = patientRepository.getById(patientId);
            if (patientToUpdate != null) {
                tx = session.beginTransaction();
                patientToUpdate.setFirstName(updatedPatient.getFirstName());
                patientToUpdate.setLastName(updatedPatient.getLastName());
                patientToUpdate.setBirthDate(updatedPatient.getBirthDate());
                patientToUpdate.setImageUrl(updatedPatient.getImageUrl());
                tx.commit();

                return true;
            }

        } catch (Exception e) {
            if (tx != null) {
                tx.rollback();
                e.printStackTrace();
            }
        }
        return false;
    }

    public boolean updateAPatient(long patientId, Patient updatedPatient) {
        tx = null;
        session = null;

        try {
            getSession();
            Patient patientToUpdate = patientRepository.getById(patientId);
            if (patientToUpdate != null) {
                tx = session.beginTransaction();
                patientToUpdate.setFirstName(updatedPatient.getFirstName());
                patientToUpdate.setLastName(updatedPatient.getLastName());
                patientToUpdate.setBirthDate(updatedPatient.getBirthDate());
                patientToUpdate.setImageUrl(updatedPatient.getImageUrl());
                tx.commit();

                return true;
            }

        } catch (Exception e) {
            if (tx != null) {
                tx.rollback();
                e.printStackTrace();
            }
        } finally {
            closeSession();
        }
        return false;
    }

Try With Resources try(Session session=HibernateSession.getSessionFactory().openSession()) in method public updateAPatient(patientId long, updatedPatient Patient) : boolean from class com.consultations.patientsjee.service.PatientService


    public Bag(){
        studentsList = new ArrayList<>(); //tolto argomento da <> come vuole Intellij
    }

    public Bag(){
        studentsList = new ArrayList<Student>();
    }

Replace Generic With Diamond ArrayList<Student> with ArrayList<> in method public Bag() from class it.polimi.ingsw.Bag