Java Code Examples for org.apache.commons.collections4.CollectionUtils#addIgnoreNull()

The following examples show how to use org.apache.commons.collections4.CollectionUtils#addIgnoreNull() . 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: DeleteDiscontinuedConfigurationEntriesStepTest.java    From multiapps-controller with Apache License 2.0 5 votes vote down vote up
private List<ConfigurationEntry> getEntriesToDelete() {
    List<ConfigurationEntry> result = new ArrayList<>();
    for (Long id : stepInput.idsOfExpectedEntriesToDelete) {
        CollectionUtils.addIgnoreNull(result, findEntry(stepInput.entriesForMta, id));
    }
    return result;
}
 
Example 2
Source File: ApplicationCloudModelBuilder.java    From multiapps-controller with Apache License 2.0 5 votes vote down vote up
protected List<String> getApplicationServices(Module module, Predicate<ResourceAndResourceType> filterRule) {
    Set<String> services = new LinkedHashSet<>();
    for (RequiredDependency dependency : module.getRequiredDependencies()) {
        ResourceAndResourceType resourceWithType = getResourceWithType(dependency.getName());
        if (resourceWithType != null && filterRule.test(resourceWithType)) {
            CollectionUtils.addIgnoreNull(services, NameUtil.getServiceName(resourceWithType.getResource()));
        }
    }
    return new ArrayList<>(services);
}
 
Example 3
Source File: ParametersChainBuilder.java    From multiapps with Apache License 2.0 5 votes vote down vote up
protected static List<Map<String, Object>> getParametersList(List<RequiredDependency> dependencies, Module module,
                                                             ModuleType moduleType, DeploymentDescriptor descriptor) {
    List<ParametersContainer> containers = new ArrayList<>(dependencies);
    CollectionUtils.addIgnoreNull(containers, module);
    CollectionUtils.addIgnoreNull(containers, moduleType);
    CollectionUtils.addIgnoreNull(containers, descriptor);
    return PropertiesUtil.getParametersList(containers);
}
 
Example 4
Source File: PropertiesChainBuilder.java    From multiapps with Apache License 2.0 5 votes vote down vote up
protected static List<Map<String, Object>> getPropertiesList(List<RequiredDependency> dependencies, Module module,
                                                             ModuleType moduleType) {
    List<PropertiesContainer> containers = new ArrayList<>(dependencies);
    CollectionUtils.addIgnoreNull(containers, module);
    CollectionUtils.addIgnoreNull(containers, moduleType);
    return PropertiesUtil.getPropertiesList(containers);
}
 
Example 5
Source File: ExtensionDescriptorChainBuilder.java    From multiapps with Apache License 2.0 5 votes vote down vote up
private List<ExtensionDescriptor> build(DeploymentDescriptor deploymentDescriptor,
                                        Map<String, ExtensionDescriptor> extensionDescriptorsPerParent) {
    List<ExtensionDescriptor> chain = new ArrayList<>();
    Descriptor currentDescriptor = deploymentDescriptor;
    while (currentDescriptor != null) {
        ExtensionDescriptor nextDescriptor = extensionDescriptorsPerParent.remove(currentDescriptor.getId());
        CollectionUtils.addIgnoreNull(chain, nextDescriptor);
        currentDescriptor = nextDescriptor;
    }
    if (!extensionDescriptorsPerParent.isEmpty() && isStrict) {
        throw new ContentException(Messages.CANNOT_BUILD_EXTENSION_DESCRIPTOR_CHAIN_BECAUSE_DESCRIPTORS_0_HAVE_AN_UNKNOWN_PARENT,
                                   String.join(",", Descriptor.getIds(extensionDescriptorsPerParent.values())));
    }
    return chain;
}
 
Example 6
Source File: SearchServiceUtilities.java    From airsonic-advanced with GNU General Public License v3.0 4 votes vote down vote up
public final boolean addIgnoreNull(Collection collection, Object object) {
    return CollectionUtils.addIgnoreNull(collection, object);
}
 
Example 7
Source File: SearchServiceUtilities.java    From airsonic with GNU General Public License v3.0 4 votes vote down vote up
public final boolean addIgnoreNull(Collection collection, Object object) {
    return CollectionUtils.addIgnoreNull(collection, object);
}
 
Example 8
Source File: CollectionUtilsGuideUnitTest.java    From tutorials with MIT License 4 votes vote down vote up
@Test
public void givenList_whenAddIgnoreNull_thenNoNullAdded() {
    CollectionUtils.addIgnoreNull(list1, null);
    assertFalse(list1.contains(null));
}