List of usage examples for java.lang Boolean compare
public static int compare(boolean x, boolean y)
From source file:org.wso2.carbon.analytics.dataservice.core.indexing.sort.RecordSortUtils.java
private static int compareValues(AnalyticsSchema.ColumnType type, Object value1, Object value2) throws AnalyticsException { int compareInt; switch (type) { case STRING://from ww w . j av a 2s . c o m compareInt = ((String) value1).compareTo(((String) value2)); break; case INTEGER: compareInt = Integer.compare((Integer) value1, (Integer) value2); break; case LONG: compareInt = Long.compare((Long) value1, (Long) value2); break; case FLOAT: compareInt = Float.compare((Float) value1, (Float) value2); break; case DOUBLE: compareInt = Double.compare((Double) value1, (Double) value2); break; case BOOLEAN: compareInt = Boolean.compare((Boolean) value1, (Boolean) value2); break; default: throw new AnalyticsException("Cannot sort values of type: " + type); } return compareInt; }
From source file:org.ops4j.pax.web.resources.jsf.OsgiResourceHandler.java
private Optional<JsfResourceQueryResult> matchResources(OsgiResourceLocator service, JsfResourceQuery query) { Collection<JsfResourceQueryResult> matchedResults = service.findResources(query); VersionComparator versionComparator = new VersionComparator(); return matchedResults.stream().max((o1, o2) -> { int localeCompare = Boolean.compare(o1.isMatchedLocalePrefix(), o2.isMatchedLocalePrefix()); int libraryCompare = versionComparator.compare(o1.getLibraryVersion(), o2.getLibraryVersion()); int resourceCompare = versionComparator.compare(o1.getResourceVersion(), o2.getResourceVersion()); if (localeCompare != 0) { // locale differs, so the one that matched is ranked higher return localeCompare; } else if (libraryCompare != 0) { // locale is the same, but library-version differs...higher library wins return libraryCompare; } else {//from w w w . j a v a 2s . c om // prior comparission is equal, use resource-version return resourceCompare; } }); }
From source file:aiai.ai.launchpad.experiment.ExperimentsController.java
@GetMapping(value = "/experiment-info/{id}") public String info(@PathVariable Long id, Model model, final RedirectAttributes redirectAttributes, @ModelAttribute("errorMessage") final String errorMessage) { Experiment experiment = experimentRepository.findById(id).orElse(null); if (experiment == null) { redirectAttributes.addFlashAttribute("errorMessage", "#282.01 experiment wasn't found, experimentId: " + id); return "redirect:/launchpad/experiments"; }/*from w w w .j a v a 2s . co m*/ for (ExperimentHyperParams hyperParams : experiment.getHyperParams()) { if (StringUtils.isBlank(hyperParams.getValues())) { continue; } ExperimentUtils.NumberOfVariants variants = ExperimentUtils .getNumberOfVariants(hyperParams.getValues()); hyperParams.setVariants(variants.status ? variants.count : 0); } if (experiment.getFlowInstanceId() == null) { model.addAttribute("infoMessages", Collections.singleton("Launch is disabled, dataset isn't assigned")); } ExperimentResult experimentResult = new ExperimentResult(); experimentResult.features = experimentFeatureRepository.findByExperimentId(experiment.getId()); experimentResult.features.sort( (ExperimentFeature o1, ExperimentFeature o2) -> (Boolean.compare(o2.isFinished, o1.isFinished))); model.addAttribute("experiment", experiment); model.addAttribute("experimentResult", experimentResult); return "launchpad/experiment-info"; }
From source file:com.vuze.plugin.azVPN_Air.Checker.java
private PortInfo[] parsePorts(BufferedReader rd, String bindIPString, StringBuffer token) throws IOException { Pattern patPort = Pattern.compile(REGEX_Port); Pattern patToken = Pattern.compile(REGEX_Token); Pattern patFwdToIP = Pattern.compile(REGEX_PortForwardedTo); Map<String, PortInfo> mapPorts = new HashMap<String, PortInfo>(); String line = ""; String lastPortFound = null;/* ww w.j a v a 2 s. c o m*/ while ((line = rd.readLine()) != null) { Matcher matcher = patPort.matcher(line); boolean found = matcher.find(); if (found) { while (found) { lastPortFound = matcher.group(1); mapPorts.put(lastPortFound, new PortInfo(lastPortFound, false)); Matcher matcherFwdToIP = patFwdToIP.matcher(line); while (matcherFwdToIP.find()) { String ip = matcherFwdToIP.group(1); if (ip.equals(bindIPString)) { mapPorts.put(lastPortFound, new PortInfo(lastPortFound, true)); } } found = matcher.find(); } } else { if (lastPortFound != null) { Matcher matcherFwdToIP = patFwdToIP.matcher(line); while (matcherFwdToIP.find()) { String ip = matcherFwdToIP.group(1); if (ip.equals(bindIPString)) { mapPorts.put(lastPortFound, new PortInfo(lastPortFound, true)); } } } } if (token != null && token.length() == 0) { Matcher matcherToken = patToken.matcher(line); if (matcherToken.find()) { token.append(matcherToken.group(1)); } } } PortInfo[] array = mapPorts.values().toArray(new PortInfo[0]); Arrays.sort(array, new Comparator<PortInfo>() { public int compare(PortInfo arg0, PortInfo arg1) { return Boolean.compare(arg1.ourBinding, arg0.ourBinding); } }); return array; }
From source file:org.cgiar.ccafs.marlo.action.projects.ProjectPartnerAction.java
@Override public void prepare() throws Exception { projectID = Long/*from w w w . ja v a 2s.c o m*/ .parseLong(StringUtils.trim(this.getRequest().getParameter(APConstants.PROJECT_REQUEST_ID))); loggedCrp = (GlobalUnit) this.getSession().get(APConstants.SESSION_CRP); loggedCrp = crpManager.getGlobalUnitById(loggedCrp.getId()); if (this.getRequest().getParameter(APConstants.TRANSACTION_ID) != null) { transaction = StringUtils.trim(this.getRequest().getParameter(APConstants.TRANSACTION_ID)); Project history = (Project) auditLogManager.getHistory(transaction); if (history != null) { project = history; project.setPartners(project.getProjectPartners().stream().filter(c -> c.isActive()) .collect(Collectors.toList())); for (ProjectPartner projectPartner : project.getPartners()) { projectPartner.setPartnerPersons(projectPartner.getProjectPartnerPersons().stream() .filter(ppp -> ppp.isActive()).collect(Collectors.toList())); } ProjectPartner leader = project.getLeader(); if (leader != null) { // First we remove the element from the array. project.getPartners().remove(leader); // then we add it to the first position. project.getPartners().add(0, leader); // Or you could use a comparator and sort or just order the elements in javascript! } Collections.sort(project.getPartners(), (p1, p2) -> Boolean.compare(this.isPPA(p2.getInstitution()), this.isPPA(p1.getInstitution()))); List<HistoryDifference> differences = new ArrayList<>(); Map<String, String> specialList = new HashMap<>(); int i = 0; for (ProjectPartner projectPartner : project.getPartners()) { int[] index = new int[1]; index[0] = i; differences.addAll(historyComparator.getDifferencesList(projectPartner, transaction, specialList, "project.partners[" + i + "]", "project", 1)); int j = 0; for (ProjectPartnerPerson partnerPerson : projectPartner.getProjectPartnerPersons()) { int[] indexPartners = new int[2]; indexPartners[0] = i; indexPartners[1] = j; differences.addAll(historyComparator.getDifferencesList(partnerPerson, transaction, specialList, "project.partners[" + i + "].partnerPersons[" + j + "]", "project.projectPartner", 2)); j++; } int k = 0; for (ProjectPartnerContribution projectPartnerContribution : projectPartner .getProjectPartnerContributions()) { differences.addAll( historyComparator.getDifferencesList(projectPartnerContribution, transaction, specialList, "project.partners[" + i + "].partnerContributors[" + k + "]", "project.partnerContributors", 2)); k++; } ; List<ProjectPartnerOverall> overalls = projectPartner.getProjectPartnerOveralls().stream() .filter(c -> c.isActive()).collect(Collectors.toList()); if (!overalls.isEmpty()) { if (!historyComparator.getDifferencesList(overalls.get(0), transaction, specialList, "project.partners[" + i + "].partnerContributors[" + k + "]", "project.partnerContributors", 2).isEmpty()) { if (!differences.contains("project.overall")) { differences.add(new HistoryDifference(UUID.randomUUID().toString(), "project.overall", true, "", "")); } } } k = 0; for (ProjectPartnerPartnership projectPartnerPartnership : projectPartner .getProjectPartnerPartnerships()) { specialList.put(APConstants.PROJECT_PARTNER_PARTNERSHIP_COUNTRY_RELATION, "partnershipLocationsIds"); differences.addAll(historyComparator.getDifferencesList(projectPartnerPartnership, transaction, specialList, "project.partners[" + i + "].projectPartnerPartnership[" + k + "]", "project.projectPartner.partnerPartnerships", 2)); k++; } i++; } if (this.isLessonsActive()) { this.loadLessons(loggedCrp, project); } if (project.getProjectComponentLesson() != null) { differences.addAll(historyComparator.getDifferencesList(project.getProjectComponentLesson(), transaction, specialList, "project.projectComponentLesson", "project", 1)); } if ((project.getProjecInfoPhase(this.getActualPhase())) != null) { project.setProjectInfo(project.getProjecInfoPhase(this.getActualPhase())); } int k = 0; this.setDifferences(differences); } else { this.transaction = null; this.setTransaction("-1"); } } else { project = projectManager.getProjectById(projectID); if ((project.getProjecInfoPhase(this.getActualPhase())) != null) { project.setProjectInfo(project.getProjecInfoPhase(this.getActualPhase())); } } if (project != null) { Path path = this.getAutoSaveFilePath(); if (path.toFile().exists() && this.getCurrentUser().isAutoSave()) { BufferedReader reader = null; reader = new BufferedReader(new FileReader(path.toFile())); Gson gson = new GsonBuilder().create(); JsonObject jReader = gson.fromJson(reader, JsonObject.class); reader.close(); AutoSaveReader autoSaveReader = new AutoSaveReader(); project = (Project) autoSaveReader.readFromJson(jReader); // We load some BD objects, since the draft only keeps IDs and some data is shown with a different labe Project projectDb = projectManager.getProjectById(project.getId()); project.getProjectInfo().setPhase(projectDb.getProjecInfoPhase(this.getActualPhase()).getPhase()); this.projectPPAPartners = new ArrayList<ProjectPartner>(); for (ProjectPartner pp : project.getPartners()) { if (pp.getInstitution() != null) { if (pp.getInstitution().getId() != null || pp.getInstitution().getId() != -1) { Institution inst = institutionManager.getInstitutionById(pp.getInstitution().getId()); if (inst != null) { if (inst.getCrpPpaPartners().stream().filter(c -> c.isActive()) .collect(Collectors.toList()).size() > 0) { this.projectPPAPartners.add(pp); } pp.setInstitution(inst); pp.getInstitution().setLocations(pp.getInstitution().getInstitutionsLocations() .stream().filter(c -> c.isActive()).collect(Collectors.toList())); } } } if (pp.getSelectedLocations() != null) { List<InstitutionLocation> locElements = new ArrayList<>(); for (InstitutionLocation locElement : pp.getSelectedLocations()) { LocElement locElementDB = locationManager .getLocElementByISOCode(locElement.getLocElement().getIsoAlpha2()); if (locElementDB != null && pp.getInstitution() != null && pp.getInstitution().getId() != null) { InstitutionLocation institutionLocation = institutionLocationManager.findByLocation( locElementDB.getId(), pp.getInstitution().getId().longValue()); locElements.add(institutionLocation); } } pp.getSelectedLocations().clear(); pp.getSelectedLocations().addAll(locElements); } if (pp.getPartnerPersons() != null) { for (ProjectPartnerPerson projectPartnerPerson : pp.getPartnerPersons()) { if (projectPartnerPerson.getUser().getId() != null) { projectPartnerPerson .setUser(userManager.getUser(projectPartnerPerson.getUser().getId())); } } } if (pp.getPartnerContributors() != null) { for (ProjectPartnerContribution projectPartnerContribution : pp.getPartnerContributors()) { if (projectPartnerContribution.getProjectPartnerContributor().getInstitution() .getId() != null) { projectPartnerContribution.getProjectPartnerContributor().setInstitution( institutionManager.getInstitutionById(projectPartnerContribution .getProjectPartnerContributor().getInstitution().getId())); } } } if (pp.getProjectPartnerPartnership() != null) { ProjectPartnerPartnership projectPartnerPartnership = pp.getProjectPartnerPartnership(); // Countries if (projectPartnerPartnership.getPartnershipLocationsIsosText() != null) { String[] locationsIsos = projectPartnerPartnership.getPartnershipLocationsIsosText() .replace("[", "").replace("]", "").split(","); List<String> locations = new ArrayList<>(); for (String value : Arrays.asList(locationsIsos)) { locations.add(value.trim()); } projectPartnerPartnership.setPartnershipLocationsIsos(locations); } // Research Phases if (projectPartnerPartnership.getResearchPhasesIdsText() != null) { String[] researchPhasesIds = projectPartnerPartnership.getResearchPhasesIdsText() .replace("[", "").replace("]", "").split(","); List<Long> researchPhases = new ArrayList<>(); for (String value : Arrays.asList(researchPhasesIds)) { researchPhases.add(Long.parseLong(value.trim())); } projectPartnerPartnership.setResearchPhasesIds(researchPhases); } } } this.setDraft(true); } else { this.setDraft(false); if (project.getProjecInfoPhase(this.getActualPhase()).isProjectEditLeader()) { project.setPartners(project.getProjectPartners().stream() .filter(c -> c.isActive() && c.getPhase().equals(this.getActualPhase())) .collect(Collectors.toList())); } else { List<ProjectPartner> partnes = new ArrayList<>(); for (ProjectPartner projectPartner : project.getProjectPartners().stream() .filter(c -> c.isActive() && c.getPhase().equals(this.getActualPhase())) .collect(Collectors.toList())) { Institution inst = institutionManager .getInstitutionById(projectPartner.getInstitution().getId()); if (!inst.getCrpPpaPartners().stream() .filter(insti -> insti.isActive() && insti.getCrp().getId().longValue() == this.getCrpID().longValue()) .collect(Collectors.toList()).isEmpty()) { partnes.add(projectPartner); } } project.setPartners(partnes); } this.projectPPAPartners = new ArrayList<ProjectPartner>(); for (ProjectPartner projectPartner : project.getPartners()) { projectPartner.setSelectedLocations(new ArrayList<>()); for (ProjectPartnerLocation projectPartnerLocation : projectPartner.getProjectPartnerLocations() .stream().filter(c -> c.isActive()).collect(Collectors.toList())) { projectPartner.getSelectedLocations().add(projectPartnerLocation.getInstitutionLocation()); } projectPartner.getInstitution() .setLocations(projectPartner.getInstitution().getInstitutionsLocations().stream() .filter(c -> c.isActive()).collect(Collectors.toList())); projectPartner.setPartnerPersons(projectPartner.getProjectPartnerPersons().stream() .filter(c -> c.isActive()).collect(Collectors.toList())); // Parnership if (projectPartner.getProjectPartnerPartnerships() != null) { projectPartner.setPartnerPartnerships( new ArrayList<>(projectPartner.getProjectPartnerPartnerships().stream() .filter(c -> c.isActive()).collect(Collectors.toList()))); if (projectPartner.getPartnerPartnerships().size() > 0) { projectPartner .setProjectPartnerPartnership(projectPartner.getPartnerPartnerships().get(0)); // Partnership Locations if (projectPartner.getProjectPartnerPartnership() .getProjectPartnerPartnershipLocations() == null) { projectPartner.getProjectPartnerPartnership() .setPartnershipLocations(new ArrayList<>()); } else { List<ProjectPartnerPartnershipLocation> locations = projectPartner .getProjectPartnerPartnership().getProjectPartnerPartnershipLocations() .stream().filter(pl -> pl.isActive()).collect(Collectors.toList()); projectPartner.getProjectPartnerPartnership().setPartnershipLocations(locations); } if (projectPartner.getProjectPartnerPartnership().getPartnershipLocations() != null) { for (ProjectPartnerPartnershipLocation location : projectPartner .getProjectPartnerPartnership().getPartnershipLocations()) { projectPartner.getProjectPartnerPartnership().getPartnershipLocationsIsos() .add(location.getLocation().getIsoAlpha2()); } } // Partnership Research Phases if (projectPartner.getProjectPartnerPartnership() .getProjectPartnerPartnershipResearchPhases() == null) { projectPartner.getProjectPartnerPartnership() .setPartnershipResearchPhases(new ArrayList<>()); } else { List<ProjectPartnerPartnershipResearchPhase> partnershipResearchPhases = projectPartner .getProjectPartnerPartnership().getProjectPartnerPartnershipResearchPhases() .stream().filter(rf -> rf.isActive()).collect(Collectors.toList()); projectPartner.getProjectPartnerPartnership() .setPartnershipResearchPhases(partnershipResearchPhases); } if (projectPartner.getProjectPartnerPartnership() .getPartnershipResearchPhases() != null) { for (ProjectPartnerPartnershipResearchPhase partnershipResearchPhase : projectPartner .getProjectPartnerPartnership().getPartnershipResearchPhases()) { projectPartner.getProjectPartnerPartnership().getResearchPhasesIds().add( partnershipResearchPhase.getRepIndPhaseResearchPartnership().getId()); } } } else { projectPartner.setProjectPartnerPartnership(new ProjectPartnerPartnership()); } } if (this.isPPA(projectPartner.getInstitution())) { this.projectPPAPartners.add(projectPartner); } List<ProjectPartnerContribution> contributors = new ArrayList<>(); List<ProjectPartnerContribution> partnerContributions = projectPartner .getProjectPartnerContributions().stream() .filter(c -> c.isActive() && c.getProjectPartner().isActive()) .collect(Collectors.toList()); for (ProjectPartnerContribution projectPartnerContribution : partnerContributions) { contributors.add(projectPartnerContribution); } projectPartner.setPartnerContributors(contributors); Institution institution = projectPartner.getInstitution(); if (institution != null) { List<InstitutionLocation> institutionLocations = new ArrayList<>(); institutionLocations.addAll(institution.getLocations()); for (InstitutionLocation institutionLocation : institutionLocations) { if (projectPartner.getSelectedLocations() != null) { if (projectPartner.getSelectedLocations().contains(institutionLocation)) { institution.getLocations().remove(institutionLocation); } } } } } if (this.isLessonsActive()) { this.loadLessons(loggedCrp, project); } } } String params[] = { loggedCrp.getAcronym(), project.getId() + "" }; this.setBasePermission(this.getText(Permission.PROJECT_PARTNER_BASE_PERMISSION, params)); plRole = roleManager.getRoleById(Long.parseLong((String) this.getSession().get(APConstants.CRP_PL_ROLE))); pcRole = roleManager.getRoleById(Long.parseLong((String) this.getSession().get(APConstants.CRP_PC_ROLE))); // Getting the list of all institutions Project projectDb = projectManager.getProjectById(project.getId()); Boolean isLeaderEdit = projectDb.getProjecInfoPhase(this.getActualPhase()).isProjectEditLeader(); Boolean isAdministrative = projectDb.getProjecInfoPhase(this.getActualPhase()).getAdministrative(); project.getProjectInfo().setProjectEditLeader(isLeaderEdit); project.getProjectInfo().setAdministrative(isAdministrative); if (!isLeaderEdit) { allInstitutions = new ArrayList<>(); for (CrpPpaPartner crpPpaPartner : crpPpaPartnerManager .findAll().stream().filter(c -> c.getCrp().getId().longValue() == loggedCrp.getId().longValue() && c.isActive() && c.getPhase().equals(this.getActualPhase())) .collect(Collectors.toList())) { allInstitutions.add(crpPpaPartner.getInstitution()); } } else { allInstitutions = institutionManager.findAll().stream().filter(c -> c.isActive()) .collect(Collectors.toList()); } allInstitutions.sort((p1, p2) -> p1.getName().compareTo(p2.getName())); // Getting the list of all PPA institutions allPPAInstitutions = new ArrayList<>(); for (CrpPpaPartner crpPpaPartner : crpPpaPartnerManager .findAll().stream().filter(c -> c.getCrp().getId().longValue() == loggedCrp.getId().longValue() && c.isActive() && c.getPhase().equals(this.getActualPhase())) .collect(Collectors.toList())) { allPPAInstitutions.add(crpPpaPartner.getInstitution()); } allPPAInstitutions.sort((p1, p2) -> p1.getName().compareTo(p2.getName())); // Getting all the countries countries = locationManager.findAll().stream() .filter(c -> c.isActive() && c.getLocElementType().getId() == 2).collect(Collectors.toList()); // Getting all partner types intitutionTypes = institutionTypeManager.findAll(); if (this.isReportingActive()) { allRepIndResearchPhases = repIndPhaseResearchPartnershipManager.findAll(); allRepIndGeographicScope = repIndGeographicScopeManager.findAll(); allRepIndRegions = repIndRegionManager.findAll(); } ProjectPartner leader = project.getLeader(); if (leader != null) { // First we remove the element from the array. project.getPartners().remove(leader); // then we add it to the first position. project.getPartners().add(0, leader); } Collections.sort(project.getPartners(), (p1, p2) -> Boolean.compare(this.isPPA(p2.getInstitution()), this.isPPA(p1.getInstitution()))); partnerPersonTypes = new HashMap<>(); partnerPersonTypes.put(APConstants.PROJECT_PARTNER_CP, this.getText("projectPartners.types.CP")); if (this.hasPermission("leader")) { partnerPersonTypes.put(APConstants.PROJECT_PARTNER_PL, this.getText("projectPartners.types.PL")); } if (this.hasPermission("coordinator")) { partnerPersonTypes.put(APConstants.PROJECT_PARTNER_PC, this.getText("projectPartners.types.PC")); } if (this.isHttpPost()) { project.getPartners().clear(); } }
From source file:org.apache.carbondata.core.scan.filter.FilterUtil.java
public static int compareFilterKeyBasedOnDataType(String dictionaryVal, String memberVal, DataType dataType) { try {/*from w ww. ja v a 2 s. c om*/ if (dataType == DataTypes.BOOLEAN) { return Boolean.compare((Boolean.parseBoolean(dictionaryVal)), (Boolean.parseBoolean(memberVal))); } else if (dataType == DataTypes.SHORT) { return Short.compare((Short.parseShort(dictionaryVal)), (Short.parseShort(memberVal))); } else if (dataType == DataTypes.INT) { return Integer.compare((Integer.parseInt(dictionaryVal)), (Integer.parseInt(memberVal))); } else if (dataType == DataTypes.DOUBLE) { return Double.compare((Double.parseDouble(dictionaryVal)), (Double.parseDouble(memberVal))); } else if (dataType == DataTypes.LONG) { return Long.compare((Long.parseLong(dictionaryVal)), (Long.parseLong(memberVal))); } else if (dataType == DataTypes.BOOLEAN) { return Boolean.compare((Boolean.parseBoolean(dictionaryVal)), (Boolean.parseBoolean(memberVal))); } else if (dataType == DataTypes.DATE || dataType == DataTypes.TIMESTAMP) { String format = CarbonUtil.getFormatFromProperty(dataType); SimpleDateFormat parser = new SimpleDateFormat(format); Date dateToStr; Date dictionaryDate; dateToStr = parser.parse(memberVal); dictionaryDate = parser.parse(dictionaryVal); return dictionaryDate.compareTo(dateToStr); } else if (DataTypes.isDecimal(dataType)) { java.math.BigDecimal javaDecValForDictVal = new java.math.BigDecimal(dictionaryVal); java.math.BigDecimal javaDecValForMemberVal = new java.math.BigDecimal(memberVal); return javaDecValForDictVal.compareTo(javaDecValForMemberVal); } else { return -1; } } catch (ParseException | NumberFormatException e) { return -1; } }
From source file:org.sakaiproject.tool.messageforums.ui.MessageForumStatisticsBean.java
/** * Compares two statistics by grades./* www .j a va2 s. c om*/ * Higher grades are greater than lower grades. * Stats with equal grades are compared by name * If one has a grade, and the other doesn't, treat having a grade as greater than not having a grade * If neither has a grade, compare by name */ private static int compareGradesFromStats(DecoratedCompiledMessageStatistics stat1, DecoratedCompiledMessageStatistics stat2) { Double grd1 = getGradeFromStat(stat1); Double grd2 = getGradeFromStat(stat2); // If they're both null, or an equal grade, revert to the name comparator if ((grd1 == null && grd2 == null) || (grd1 != null && grd1.equals(grd2))) { return nameComparatorAsc.compare(stat1, stat2); } boolean exists1 = grd1 != null; boolean exists2 = grd2 != null; if (exists1 && exists2) { // Both grades exist, compare them return Double.compare(grd1, grd2); } // One grade exists and the other doesn't, Boolean compare their existence return Boolean.compare(exists1, exists2); }