Example usage for java.util Set addAll

List of usage examples for java.util Set addAll

Introduction

In this page you can find the example usage for java.util Set addAll.

Prototype

boolean addAll(Collection<? extends E> c);

Source Link

Document

Adds all of the elements in the specified collection to this set if they're not already present (optional operation).

Usage

From source file:net.ae97.pokebot.extensions.welcomemessage.WelcomeMessageExtension.java

@Override
public void runEvent(CommandEvent event) {
    Set<User> allowedUsers = new HashSet<>();
    allowedUsers.addAll(event.getChannel().getVoices());
    allowedUsers.addAll(event.getChannel().getOps());
    if (allowedUsers.contains(event.getUser())) {
        if (event.getArgs().length == 0) {
            mappings.remove(event.getChannel().getName().toLowerCase());
            event.getUser().send().notice("I will stop messaging people when they join");
        } else {/*from w  w  w .  jav  a2  s .  c o m*/
            String msg = StringUtils.join(event.getArgs(), " ");
            mappings.put(event.getChannel().getName().toLowerCase(), msg);
            event.getUser().send().notice("I will start messaging people this when they join: ");
            event.getUser().send().notice(msg);
        }
    }
}

From source file:dk.nsi.haiba.lprimporter.dao.impl.LPRDAOComposite.java

@Override
public Collection<Codes> getSygehusKoder() {
    Set<Codes> returnValue = new HashSet<Codes>();
    returnValue.addAll(minipasLPRDAO.getSygehusKoder());
    returnValue.addAll(ssiLPRDAO.getSygehusKoder());
    return new ArrayList<Codes>(returnValue);
}

From source file:dk.nsi.haiba.lprimporter.dao.impl.LPRDAOComposite.java

@Override
public Collection<Codes> getDiagnoseKoder() {
    Set<Codes> returnValue = new HashSet<Codes>();
    returnValue.addAll(minipasLPRDAO.getDiagnoseKoder());
    returnValue.addAll(ssiLPRDAO.getDiagnoseKoder());
    return new ArrayList<Codes>(returnValue);
}

From source file:dk.nsi.haiba.lprimporter.dao.impl.LPRDAOComposite.java

@Override
public Collection<Codes> getProcedureKoder() {
    Set<Codes> returnValue = new HashSet<Codes>();
    returnValue.addAll(minipasLPRDAO.getProcedureKoder());
    returnValue.addAll(ssiLPRDAO.getProcedureKoder());
    return new ArrayList<Codes>(returnValue);
}

From source file:com.intel.podm.business.redfish.services.helpers.ComposedNodeValidator.java

public void validateExistenceOfIncludedResources(RequestedNode requestedNode)
        throws RequestValidationException {
    Set<Context> contexts = new HashSet<>();
    contexts.addAll(getContexts(requestedNode.getProcessors()));
    contexts.addAll(getContexts(requestedNode.getMemoryModules()));
    contexts.addAll(getContextsOfMasterDrives(requestedNode.getRemoteDrives()));
    contexts.addAll(getContexts(requestedNode.getLocalDrives()));
    contexts.addAll(getContexts(requestedNode.getEthernetInterfaces()));

    validateContexts(contexts);//  w w  w  .  j av  a 2 s .c  o m
}

From source file:enumsupport.reverselookupmapfactory.DeduplicatdeNumberSetFactory.java

/**
 *
 * @param numberRange ???/*from ww w  .  j a  va 2  s  .c o  m*/
 * @param number  null??
 * @param numbers ??????null??????
 * @return ????(??)
 * @throws NullPointerException ?????null?????
 * @throws IllegalArgumentException ??numberrange???????
 */
public Set<T> makeSet(Range<T> numberRange, T number, T... numbers)
        throws NullPointerException, IllegalArgumentException {

    List<T> t = new ArrayList<>();
    t.add(number);

    if (numbers != null) {
        t.addAll(Arrays.asList(numbers));
    }
    for (T num : t) {
        if (num == null) {
            throw new IllegalArgumentException("?null???????");
        }
        if (!numberRange.contains(num)) {
            MessageFormat msg = new MessageFormat(
                    "????????????={0}");
            Object[] parameters = { num };
            throw new IllegalArgumentException(msg.format(parameters));
        }
    }
    Set<T> numberSet_t = Collections.synchronizedSet(new HashSet<>());
    numberSet_t.addAll(t);
    return Collections.unmodifiableSet(numberSet_t);
}

From source file:com.opengamma.integration.tool.marketdata.HtsSyncTool.java

private Set<String> filterClassifiers(Set<String> srcMasterClassifiers, Set<String> destMasterClassifiers) {
    Set<String> commonComponentNames = Sets.newLinkedHashSet();
    commonComponentNames.addAll(srcMasterClassifiers);
    commonComponentNames.retainAll(destMasterClassifiers);
    if (getCommandLine().hasOption("classifiers")) {
        List<String> classifiersList = Arrays.asList(getCommandLine().getOptionValues("classifiers"));
        Set<String> classifiers = Sets.newHashSet();
        classifiers.addAll(classifiersList);
        classifiers.removeAll(classifiers);
        if (classifiers.size() > 0) {
            System.err.println("Couldn't find classifiers: " + classifiers.toString() + ", skipping those");
        }//from   w ww.jav a 2  s  .c  om
        classifiers.clear();
        classifiers.addAll(classifiersList);
        commonComponentNames.retainAll(classifiers);
    }
    return commonComponentNames;
}

From source file:com.cimpoint.mes.server.services.ContainerServiceImpl.java

@Override
public Set<String> findContainerNumbersByWorkOrderItemNumber(String workOrderItemNumber) throws Exception {
    Set<String> result = new HashSet<String>();
    result.addAll(containerRepository.findContainersByWorkOrderItemNumber(workOrderItemNumber));
    return result;
}

From source file:com.cimpoint.mes.server.services.ContainerServiceImpl.java

@Override
public Set<String> findContainerNumbersByWorkOrderNumber(String workOrderNumber) throws Exception {
    Set<String> result = new HashSet<String>();
    result.addAll(containerRepository.findContainerByWorkOrderNumber(workOrderNumber));
    return result;
}

From source file:springfox.documentation.swagger.readers.operation.SwaggerOperationTagsReader.java

private Function<ApiOperation, Set<String>> tagsFromOperation() {
    return new Function<ApiOperation, Set<String>>() {
        @Override/* w  ww.j  a  va  2s  .c  om*/
        public Set<String> apply(ApiOperation input) {
            Set<String> tags = newTreeSet();
            tags.addAll(from(newArrayList(input.tags())).filter(emptyTags()).toSet());
            return tags;
        }
    };
}