List of usage examples for java.util Set equals
boolean equals(Object o);
From source file:com.mindquarry.desktop.client.widget.workspace.WorkspaceBrowserWidget.java
/** * Checks if a refresh of the changes list itself is needed. *//*from w ww . j a va 2 s . c om*/ public boolean refreshNeeded(Boolean applyNewChanges) { PreferenceStore store = client.getPreferenceStore(); Profile selectedProfile = Profile.getSelectedProfile(store); if (selectedProfile == null) { return false; } boolean refreshNeeded = false; ChangeSets newChanges = getAllChanges(selectedProfile); // if team selection has changed, a refresh is needed: Set<String> teamIds = changeSets.getTeamIds(); Set<String> newTeamIds = newChanges.getTeamIds(); if (!teamIds.equals(newTeamIds)) { log.debug("Changes list does need update (#1)"); refreshNeeded = true; } // no changes in team selection, compare the changes per team: if (checkChangeSetUpdateRequired(changeSets, newChanges)) { log.debug("Changes list does need update (#2)"); refreshNeeded = true; } if (applyNewChanges) { changeSets = newChanges; // create the tree of changes from the list of all changes/conflicts changeTree = new ChangeTree(changeSets.getChanges(), toIgnore); workspaceRoot = new File(selectedProfile.getWorkspaceFolder()); } if (refreshNeeded) { log.debug("Changes list does not need update"); } return refreshNeeded; }
From source file:com.espertech.esperio.csv.CSVInputAdapter.java
private boolean isUsingTitleRow(String[] firstRow, String[] propertyOrder) { if (firstRow == null) { return false; }//from w w w . j a v a2 s. c o m Set<String> firstRowSet = new HashSet<String>(Arrays.asList(firstRow)); Set<String> propertyOrderSet = new HashSet<String>(Arrays.asList(propertyOrder)); return firstRowSet.equals(propertyOrderSet); }
From source file:at.ac.tuwien.qse.sepm.gui.controller.impl.PhotoInspectorImpl.java
private void saveTags(Photo photo) { LOGGER.debug("updating tags of {}", photo); // Find the new tags. Set<String> oldTags = photo.getData().getTags().stream().map(Tag::getName).collect(Collectors.toSet()); Set<String> newTags = tagPicker.filter(oldTags); LOGGER.debug(tagPicker.getTags());/* w ww . j ava 2 s. c o m*/ LOGGER.debug("old tags {} will be updated to new tags {}", oldTags, newTags); if (oldTags.equals(newTags)) { LOGGER.debug("tags have not changed of photo {}", photo); return; } // Replace tags with new ones. photo.getData().getTags().clear(); newTags.forEach(tag -> photo.getData().getTags().add(new Tag(null, tag))); savePhoto(photo); onUpdate(); }
From source file:org.apache.accumulo.server.security.UserImpersonation.java
/** * Parses all properties that start with {@link Property#INSTANCE_RPC_SASL_PROXYUSERS}. This approach was the original configuration method, but does not work * with Ambari.// www . j av a 2 s. c o m * * @param configProperties * The relevant configuration properties for impersonation. */ @SuppressWarnings("javadoc") private void parseMultiPropertyConfiguration(Map<String, String> configProperties) { @SuppressWarnings("deprecation") final String configKey = Property.INSTANCE_RPC_SASL_PROXYUSERS.getKey(); for (Entry<String, String> entry : configProperties.entrySet()) { String aclKey = entry.getKey().substring(configKey.length()); int index = aclKey.lastIndexOf('.'); if (-1 == index) { throw new RuntimeException("Expected 2 elements in key suffix: " + aclKey); } final String remoteUser = aclKey.substring(0, index).trim(), usersOrHosts = aclKey.substring(index + 1).trim(); UsersWithHosts usersWithHosts = proxyUsers.get(remoteUser); if (null == usersWithHosts) { usersWithHosts = new UsersWithHosts(); proxyUsers.put(remoteUser, usersWithHosts); } if (USERS.equals(usersOrHosts)) { String userString = entry.getValue().trim(); if (ALL.equals(userString)) { usersWithHosts.setAcceptAllUsers(true); } else if (!usersWithHosts.acceptsAllUsers()) { Set<String> users = usersWithHosts.getUsers(); if (null == users) { users = new HashSet<>(); usersWithHosts.setUsers(users); } String[] userValues = StringUtils.split(userString, ','); users.addAll(Arrays.<String>asList(userValues)); } } else if (HOSTS.equals(usersOrHosts)) { String hostsString = entry.getValue().trim(); if (ALL.equals(hostsString)) { usersWithHosts.setAcceptAllHosts(true); } else if (!usersWithHosts.acceptsAllHosts()) { Set<String> hosts = usersWithHosts.getHosts(); if (null == hosts) { hosts = new HashSet<>(); usersWithHosts.setHosts(hosts); } String[] hostValues = StringUtils.split(hostsString, ','); hosts.addAll(Arrays.<String>asList(hostValues)); } } else { log.debug("Ignoring key " + aclKey); } } }
From source file:org.ulyssis.ipp.ui.widgets.TeamPanel.java
private void updateTags(Snapshot snapshot) { Set<TagId> newTags = new HashSet<>(); snapshot.getTeamTagMap().getTagToTeam().forEach((tag, teamNb) -> { if (team.getTeamNb() == teamNb) { newTags.add(tag);/*from ww w.j a va2s .c o m*/ } }); if (!newTags.equals(oldTags)) { oldTags = newTags; tagsTable.clear(); for (TagId tag : newTags) { WTemplate tagsTableItem = new WTemplate(WString.tr("tags-table-item")); tagsTableItem.bindString("tag-id", tag.toString()); final WPushButton removeTagButton = new WPushButton("Remove"); tagsTableItem.bindWidget("remove-button", removeTagButton); removeTagButton.clicked().addListener(this, () -> removeTag(tag, removeTagButton)); tagsTable.addWidget(tagsTableItem); } } }
From source file:org.mifosplatform.portfolio.group.domain.Group.java
public List<String> updateClientMembersIfDifferent(final Set<Client> clientMembersSet) { List<String> differences = new ArrayList<String>(); if (!clientMembersSet.equals(this.clientMembers)) { final Set<Client> diffClients = Sets.symmetricDifference(clientMembersSet, this.clientMembers); final String[] diffClientsIds = getClientIds(diffClients); if (diffClientsIds != null) { differences = Arrays.asList(diffClientsIds); }/* ww w . j a v a 2s .co m*/ this.clientMembers = clientMembersSet; } return differences; }
From source file:org.commonjava.maven.cartographer.preset.ScopedProjectFilter.java
@Override public ProjectRelationshipFilter getChildFilter(final ProjectRelationship<?> lastRelationship) { switch (lastRelationship.getType()) { case BOM://from w w w .j a v a2 s . co m return StructuralRelationshipsFilter.INSTANCE; case PARENT: { return this; } case EXTENSION: case PLUGIN: case PLUGIN_DEP: { // logger.info( "getChildFilter({})", lastRelationship ); return StructuralRelationshipsFilter.INSTANCE; } default: { // logger.info( "getChildFilter({})", lastRelationship ); final DependencyRelationship dr = (DependencyRelationship) lastRelationship; if (DependencyScope.test == dr.getScope() || DependencyScope.provided == dr.getScope()) { return StructuralRelationshipsFilter.INSTANCE; } Set<ProjectRef> exc = null; boolean excChanged = false; // if there are new excludes, ALWAYS construct a new child filter. if (dr.getExcludes() != null && !dr.getExcludes().isEmpty()) { if (excludes != null) { exc = new HashSet<ProjectRef>(excludes); exc.addAll(dr.getExcludes()); excChanged = !exc.equals(excludes); } else { exc = new HashSet<ProjectRef>(dr.getExcludes()); excChanged = true; } } final ProjectRelationshipFilter nextFilter = filter.getChildFilter(lastRelationship); boolean construct = excChanged || !filter.equals(nextFilter); if (construct) { return new ScopedProjectFilter(nextFilter, acceptManaged, exc); } return this; } } }
From source file:org.commonjava.cartographer.graph.preset.ScopedProjectFilter.java
@Override public ProjectRelationshipFilter getChildFilter(final ProjectRelationship<?, ?> lastRelationship) { switch (lastRelationship.getType()) { case BOM:/*from w w w. j a va 2s. com*/ return StructuralRelationshipsFilter.INSTANCE; case PARENT: { return this; } case EXTENSION: case PLUGIN: case PLUGIN_DEP: { // logger.info( "getChildFilter({})", lastRelationship ); return StructuralRelationshipsFilter.INSTANCE; } default: { // logger.info( "getChildFilter({})", lastRelationship ); final DependencyRelationship dr = (DependencyRelationship) lastRelationship; if (DependencyScope.test == dr.getScope() || DependencyScope.provided == dr.getScope()) { return StructuralRelationshipsFilter.INSTANCE; } Set<ProjectRef> exc = null; boolean excChanged = false; // if there are new excludes, ALWAYS construct a new child filter. if (dr.getExcludes() != null && !dr.getExcludes().isEmpty()) { if (excludes != null) { exc = new HashSet<ProjectRef>(excludes); exc.addAll(dr.getExcludes()); excChanged = !exc.equals(excludes); } else { exc = new HashSet<ProjectRef>(dr.getExcludes()); excChanged = true; } } final ProjectRelationshipFilter nextFilter = filter.getChildFilter(lastRelationship); boolean construct = excChanged || !filter.equals(nextFilter); if (construct) { return new ScopedProjectFilter(nextFilter, acceptManaged, exc); } return this; } } }
From source file:org.osaf.cosmo.scheduler.SchedulerImpl.java
public synchronized void refreshSchedules() { if (log.isDebugEnabled()) log.debug("refreshing schedlules"); // all users with schedules Set<User> users = scheduleService.getUsersWithSchedules(); // keep track of usernames processed Set<String> processed = new HashSet<String>(); for (User user : users) { processed.add(user.getUsername()); Set<Schedule> schedules = scheduleService.getSchedulesForUser(user); Set<Schedule> oldSchedules = userSchedules.get(user.getUsername()); // If no existing schedules exist, add if (oldSchedules == null) scheduleUserJobs(user, schedules); // otherwise compare schedules to existing schedules and reschedule // if necessary else if (!oldSchedules.equals(schedules)) { removeAllJobsForUser(user.getUsername()); scheduleUserJobs(user, schedules); }//from www .ja va 2 s . c o m } // prune for (String userName : userSchedules.keySet()) if (!processed.contains(userName)) removeAllJobsForUser(userName); }
From source file:br.usp.poli.lta.cereda.nfa2dfa.utils.Conversion.java
private Set<Set<Integer>> split(Set<Integer> S, Set<Set<Integer>> p) { Set<Set<Integer>> result = new HashSet<>(); Set<Token> sigma = alphabet(); Set<Integer> temp = null; HashSet<Integer> s2 = new HashSet<>(); for (Token c : sigma) { for (int s : S) { if (temp == null) { temp = getSet(s, c, p);/* ww w. ja va 2 s .c o m*/ } else { if (!temp.equals(getSet(s, c, p))) { s2.add(s); } } } temp = null; } if (!s2.isEmpty()) { Set<Integer> s1 = new HashSet<>(S); s1.removeAll(s2); result.add(s1); result.add(s2); } else { result.add(S); } return result; }