Java Code Examples for org.apache.commons.collections4.CollectionUtils#isEqualCollection()
The following examples show how to use
org.apache.commons.collections4.CollectionUtils#isEqualCollection() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GuildEmojisUpdateHandler.java From JDA with Apache License 2.0 | 6 votes |
private void handleReplace(Emote oldEmote, Emote newEmote) { if (oldEmote == null || newEmote == null) return; if (!Objects.equals(oldEmote.getName(), newEmote.getName())) { getJDA().handleEvent( new EmoteUpdateNameEvent( getJDA(), responseNumber, newEmote, oldEmote.getName())); } if (!CollectionUtils.isEqualCollection(oldEmote.getRoles(), newEmote.getRoles())) { getJDA().handleEvent( new EmoteUpdateRolesEvent( getJDA(), responseNumber, newEmote, oldEmote.getRoles())); } }
Example 2
Source File: ServiceConfig.java From Thunder with Apache License 2.0 | 6 votes |
@Override public boolean equals(Object object) { if (!(object instanceof ServiceConfig)) { return false; } ServiceConfig serviceConfig = (ServiceConfig) object; if (StringUtils.equals(this.interfaze, serviceConfig.interfaze) && StringUtils.equals(this.secretKey, serviceConfig.secretKey) && CollectionUtils.isEqualCollection(this.methods, serviceConfig.getMethods()) && this.version == serviceConfig.version && this.token == serviceConfig.token) { return true; } return false; }
Example 3
Source File: UserEntity.java From Thunder with Apache License 2.0 | 6 votes |
@Override public boolean equals(Object object) { if (!(object instanceof UserEntity)) { return false; } UserEntity userEntity = (UserEntity) object; if (StringUtils.equals(this.name, userEntity.name) && StringUtils.equals(this.password, userEntity.password) && this.type == userEntity.type && CollectionUtils.isEqualCollection(this.operations, userEntity.operations)) { return true; } return false; }
Example 4
Source File: WebCalendar.java From cuba with Apache License 2.0 | 5 votes |
@Override public void setMonthNames(Map<Month, String> monthNames) { Preconditions.checkNotNullArgument(monthNames); if (!CollectionUtils.isEqualCollection(Arrays.asList(Month.values()), monthNames.keySet())) { throw new IllegalArgumentException("Month names map doesn't contain all required values"); } String[] months = Arrays.stream(Month.values()) .map(monthNames::get) .toArray(String[]::new); component.setMonthNamesShort(months); }
Example 5
Source File: ValueProviderImpl.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ValueProviderImpl that = (ValueProviderImpl) o; return Objects.equals(name, that.name) && Objects.equals(type, that.type) && CollectionUtils.isEqualCollection(parameters, that.parameters); }
Example 6
Source File: ConfigurationParameterGroupImpl.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ConfigurationParameterGroupImpl that = (ConfigurationParameterGroupImpl) o; return Objects.equals(group, that.group) && CollectionUtils.isEqualCollection(parameters, that.parameters); }
Example 7
Source File: ConnectionInformationImpl.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof ConnectionInformationImpl)) { return false; } ConnectionInformationImpl other = (ConnectionInformationImpl) obj; return Objects.equals(configuration, other.configuration) && CollectionUtils.isEqualCollection(libraryFiles, other.libraryFiles) && CollectionUtils.isEqualCollection(otherFiles, other.otherFiles) && Objects.equals(annotations, other.annotations); }
Example 8
Source File: LegacyCollectionDsValueSource.java From cuba with Apache License 2.0 | 5 votes |
protected boolean equalCollections(Collection c1, Collection c2) { if (c1 == null) { return c2 == null; } if (c2 == null) { return false; } return CollectionUtils.isEqualCollection(c1, c2); }
Example 9
Source File: SwingXTableSettings.java From cuba with Apache License 2.0 | 5 votes |
@Override public void apply(Element element, boolean sortable) { String horizontalScroll = element.attributeValue("horizontalScroll"); if (!StringUtils.isBlank(horizontalScroll)) { table.setHorizontalScrollEnabled(Boolean.valueOf(horizontalScroll)); } loadFontPreferences(element); final Element columnsElem = element.element("columns"); if (columnsElem == null) { return; } Collection<String> modelIds = new LinkedList<>(); for (TableColumn modelColumn : table.getColumns(true)) { modelIds.add(String.valueOf(modelColumn.getIdentifier())); } Collection<String> loadedIds = new LinkedList<>(); for (Element colElem : Dom4j.elements(columnsElem, "column")) { String id = colElem.attributeValue("id"); loadedIds.add(id); } Configuration configuration = AppBeans.get(Configuration.NAME); ClientConfig clientConfig = configuration.getConfig(ClientConfig.class); if (clientConfig.getLoadObsoleteSettingsForTable() || CollectionUtils.isEqualCollection(modelIds, loadedIds)) { applyColumnSettings(element, sortable); } }
Example 10
Source File: WebTokenList.java From cuba with Apache License 2.0 | 5 votes |
protected boolean equalCollections(Collection<V> a, Collection<V> b) { if (CollectionUtils.isEmpty(a) && CollectionUtils.isEmpty(b)) { return true; } if ((CollectionUtils.isEmpty(a) && CollectionUtils.isNotEmpty(b)) || (CollectionUtils.isNotEmpty(a) && CollectionUtils.isEmpty(b))) { return false; } return CollectionUtils.isEqualCollection(a, b); }
Example 11
Source File: WebAbstractDataGrid.java From cuba with Apache License 2.0 | 5 votes |
@Override public void applySettings(Element element) { if (!isSettingsEnabled()) { return; } if (defaultSettings == null) { defaultSettings = DocumentHelper.createDocument(); defaultSettings.setRootElement(defaultSettings.addElement("presentation")); // init default settings saveSettings(defaultSettings.getRootElement()); } Element columnsElem = element.element("columns"); if (columnsElem != null) { List<Column<E>> modelColumns = getVisibleColumns(); List<String> modelIds = modelColumns.stream() .map(String::valueOf) .collect(Collectors.toList()); List<String> loadedIds = columnsElem.elements("columns").stream() .map(colElem -> colElem.attributeValue("id")) .collect(Collectors.toList()); if (CollectionUtils.isEqualCollection(modelIds, loadedIds)) { applyColumnSettings(element, modelColumns); } } }
Example 12
Source File: ConfigManager.java From DDMQ with Apache License 2.0 | 5 votes |
private synchronized void onDataChange(PProxyConfig newPProxyConfig) throws Exception { LogUtils.getMainLogger().info("proxyConfig change, old:{}, new:{}", proxyConfig, newPProxyConfig); if (!checkProxyConfig(newPProxyConfig)) { return; } //swap PProxyConfig oldProxyConfig = proxyConfig.clone(); proxyConfig = newPProxyConfig; //add new and delete not in management if (!CollectionUtils.isEqualCollection(oldProxyConfig.getTopics(), proxyConfig.getTopics())) { Set<String> topics = getTopicsInProxyConfigAndLocal(proxyConfig); updateTopics(topics); } //rocketmq client update checkAndUpdateRmqConfig(oldProxyConfig.getCarreraConfiguration().getRocketmqConfigurationMap(), proxyConfig.getCarreraConfiguration().getRocketmqConfigurationMap()); //kafka client update checkAndUpdateKafkaConfig(oldProxyConfig.getCarreraConfiguration().getKafkaConfigurationMap(), proxyConfig.getCarreraConfiguration().getKafkaConfigurationMap()); //cluster change, update all topics if (!CollectionUtils.isEqualCollection(oldProxyConfig.getBrokerClusters(), proxyConfig.getBrokerClusters())) { updateAllTopicConfig(); LogUtils.getMainLogger().info("cluster change, old:{}, new:{}", oldProxyConfig.getBrokerClusters(), proxyConfig.getBrokerClusters()); } //node rate limiter update if (oldProxyConfig.getCarreraConfiguration().getMaxTps() != proxyConfig.getCarreraConfiguration().getMaxTps() || oldProxyConfig.getCarreraConfiguration().getTpsWarningRatio() != proxyConfig.getCarreraConfiguration().getTpsWarningRatio()) { requestLimiter.updateNodeConfig(proxyConfig.getCarreraConfiguration().getTpsWarningRatio(), proxyConfig.getCarreraConfiguration().getMaxTps()); } proxyConfigService.getAndWatchIndex(proxyConfig.getTopics(), new TopicConfigCallback()); LogUtils.getMainLogger().info("proxyConfig change completely"); }
Example 13
Source File: ConsistentHashLoadBalanceExecutor.java From Thunder with Apache License 2.0 | 5 votes |
@Override protected void cacheConnectionEntityList(List<ConnectionEntity> connectionEntityList) { super.cacheConnectionEntityList(connectionEntityList); List<ConnectionEntity> entityList = locator.getAll(); if (CollectionUtils.isNotEmpty(connectionEntityList)) { if (!CollectionUtils.isEqualCollection(entityList, connectionEntityList)) { locator.updateLocator(new ArrayList<ConnectionEntity>(connectionEntityList)); } } else { if (CollectionUtils.isNotEmpty(entityList)) { locator.updateLocator(new ArrayList<ConnectionEntity>()); } } }
Example 14
Source File: MonitorEntity.java From Thunder with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object object) { if (!(object instanceof MonitorEntity)) { return false; } MonitorEntity monitorEntity = (MonitorEntity) object; if (CollectionUtils.isEqualCollection(this.types, monitorEntity.types) && CollectionUtils.isEqualCollection(this.addresses, monitorEntity.addresses)) { return true; } return false; }
Example 15
Source File: WebOptionsList.java From cuba with Apache License 2.0 | 5 votes |
protected boolean equalCollections(Collection<V> a, Collection<V> b) { if (a == null && b == null) { return true; } if (a == null || b == null) { return false; } return CollectionUtils.isEqualCollection(a, b); }
Example 16
Source File: ConsistencyExecutorImpl.java From Thunder with Apache License 2.0 | 5 votes |
private void consistBatch(String interfaze, List<ApplicationEntity> remoteList) throws Exception { List<ApplicationEntity> localList = cacheContainer.getConnectionCacheEntity().getApplicationEntityList(interfaze); if (!CollectionUtils.isEqualCollection(localList, remoteList)) { List<ApplicationEntity> intersectedList = (List<ApplicationEntity>) CollectionUtils.intersection(localList, remoteList); List<ApplicationEntity> onlineList = (List<ApplicationEntity>) CollectionUtils.subtract(remoteList, intersectedList); List<ApplicationEntity> offlineList = (List<ApplicationEntity>) CollectionUtils.subtract(localList, intersectedList); consistBatchClient(interfaze, onlineList, true); consistBatchClient(interfaze, offlineList, false); } }
Example 17
Source File: ConfigManager.java From DDMQ with Apache License 2.0 | 5 votes |
private synchronized void onDataChange(PProxyConfig newPProxyConfig) throws Exception { LogUtils.getMainLogger().info("proxyConfig change, old:{}, new:{}", proxyConfig, newPProxyConfig); if (!checkProxyConfig(newPProxyConfig)) { return; } //swap PProxyConfig oldProxyConfig = proxyConfig.clone(); proxyConfig = newPProxyConfig; //add new and delete not in management if (!CollectionUtils.isEqualCollection(oldProxyConfig.getTopics(), proxyConfig.getTopics())) { Set<String> topics = getTopicsInProxyConfigAndLocal(proxyConfig); updateTopics(topics); } //rocketmq client update checkAndUpdateRmqConfig(oldProxyConfig.getCarreraConfiguration().getRocketmqConfigurationMap(), proxyConfig.getCarreraConfiguration().getRocketmqConfigurationMap()); //kafka client update checkAndUpdateKafkaConfig(oldProxyConfig.getCarreraConfiguration().getKafkaConfigurationMap(), proxyConfig.getCarreraConfiguration().getKafkaConfigurationMap()); //cluster change, update all topics if (!CollectionUtils.isEqualCollection(oldProxyConfig.getBrokerClusters(), proxyConfig.getBrokerClusters())) { updateAllTopicConfig(); LogUtils.getMainLogger().info("cluster change, old:{}, new:{}", oldProxyConfig.getBrokerClusters(), proxyConfig.getBrokerClusters()); } //node rate limiter update if (oldProxyConfig.getCarreraConfiguration().getMaxTps() != proxyConfig.getCarreraConfiguration().getMaxTps() || oldProxyConfig.getCarreraConfiguration().getTpsWarningRatio() != proxyConfig.getCarreraConfiguration().getTpsWarningRatio()) { requestLimiter.updateNodeConfig(proxyConfig.getCarreraConfiguration().getTpsWarningRatio(), proxyConfig.getCarreraConfiguration().getMaxTps()); } proxyConfigService.getAndWatchIndex(proxyConfig.getTopics(), new TopicConfigCallback()); LogUtils.getMainLogger().info("proxyConfig change completely"); }
Example 18
Source File: WebAbstractTable.java From cuba with Apache License 2.0 | 4 votes |
@Override public void applySettings(Element element) { if (!isSettingsEnabled()) { return; } if (defaultSettings == null) { // save default view before apply custom defaultSettings = DocumentHelper.createDocument(); defaultSettings.setRootElement(defaultSettings.addElement("presentation")); saveSettings(defaultSettings.getRootElement()); } String textSelection = element.attributeValue("textSelection"); if (StringUtils.isNotEmpty(textSelection)) { component.setTextSelectionEnabled(Boolean.parseBoolean(textSelection)); if (component.getPresentations() != null) { ((TablePresentations) component.getPresentations()).updateTextSelection(); } } Element columnsElem = element.element("columns"); if (columnsElem != null) { boolean refreshWasEnabled = component.disableContentBufferRefreshing(); Collection<String> modelIds = new ArrayList<>(); for (Object column : component.getVisibleColumns()) { modelIds.add(String.valueOf(column)); } Collection<String> loadedIds = new ArrayList<>(); for (Element colElem : columnsElem.elements("columns")) { loadedIds.add(colElem.attributeValue("id")); } ClientConfig clientConfig = configuration.getConfig(ClientConfig.class); if (clientConfig.getLoadObsoleteSettingsForTable() || CollectionUtils.isEqualCollection(modelIds, loadedIds)) { applyColumnSettings(element); } component.enableContentBufferRefreshing(refreshWasEnabled); } }
Example 19
Source File: ServiceFactoryBean.java From Thunder with Apache License 2.0 | 4 votes |
protected void registerService() throws Exception { String interfaceName = interfaze.getName(); List<String> methods = ClassUtil.convertMethodList(interfaze); ApplicationEntity applicationEntity = cacheContainer.getApplicationEntity(); // 注册Service RegistryExecutor registryExecutor = executorContainer.getRegistryExecutor(); registryExecutor.registerService(interfaceName, applicationEntity); // 持久化Service配置信息 ServiceConfig serviceConfig = null; try { serviceConfig = registryExecutor.retrieveService(interfaceName, applicationEntity); } catch (SerializerException e) { LOG.warn("ServiceConfig class was upgraded, Registry Center will initialize it again"); } if (serviceConfig == null) { serviceConfig = new ServiceConfig(); serviceConfig.setInterface(interfaceName); serviceConfig.setMethods(methods); serviceConfig.setSecretKey(properties.getString(ThunderConstant.SECRET_KEY_ATTRIBUTE_NAME)); serviceConfig.setVersion(properties.getInteger(ThunderConstant.VERSION_ATTRIBUTE_NAME)); serviceConfig.setToken(properties.getLong(ThunderConstant.TOKEN_ATTRIBUTE_NAME)); registryExecutor.persistService(serviceConfig, applicationEntity); } else { List<String> methodList = serviceConfig.getMethods(); // 方法列表是null(可以是空)或者两个方法列表不相等(methods肯定不为null) if (methodList == null || !CollectionUtils.isEqualCollection(methodList, methods)) { LOG.info("ServiceConfig methods are changed, Registry Center will initialize it again"); serviceConfig.setMethods(methods); registryExecutor.persistService(serviceConfig, applicationEntity); } } Map<String, ServiceConfig> serviceConfigMap = cacheContainer.getServiceConfigMap(); serviceConfigMap.put(interfaceName, serviceConfig); // Service配置信息更改后通知服务端,包括限流和密钥 registryExecutor.addServiceConfigWatcher(interfaceName, applicationEntity); // 把限流配置回写到本地 serviceEntity.setDefaultToken(serviceConfig.getToken()); serviceEntity.setToken(serviceConfig.getToken()); }
Example 20
Source File: WitnessController.java From gsc-core with GNU Lesser General Public License v3.0 | 4 votes |
private static boolean witnessSetChanged(List<ByteString> list1, List<ByteString> list2) { return !CollectionUtils.isEqualCollection(list1, list2); }