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:descriptordump.dumpexecutor.AbstractExecutor.java

protected AbstractExecutor(TABLE_ID tid, TABLE_ID... tids) {
    List<TABLE_ID> t = new ArrayList<>();
    if (tid != null) {
        t.add(tid);//from  ww  w  .j a  v  a2s.c o  m
    } else {
        throw new NullPointerException("ID??????");
    }
    if (tids != null) {
        t.addAll(Arrays.asList(tids));
    }
    Set<TABLE_ID> temp = Collections.synchronizedSet(new HashSet<>());
    temp.addAll(t);
    this.tids = Collections.unmodifiableSet(temp);

}

From source file:org.jasig.portlet.test.web.TestPickerInterceptor.java

@Autowired
public void setPortletTests(Collection<PortletTest> portletTests) {
    final Set<PortletTest> newPortletTests = new TreeSet<PortletTest>(PortletTestComparator.INSTANCE);
    newPortletTests.addAll(portletTests);

    this.portletTests = newPortletTests;
}

From source file:org.obiba.mica.core.service.PersonService.java

@Async
@Subscribe/*w w  w .j  a va  2  s .  c om*/
public void micaConfigUpdated(MicaConfigUpdatedEvent event) {
    event.getRemovedRoles().forEach(r -> {
        log.info("Removing role {} from Persons.", r);
        Set<Person> persons = Sets.newHashSet(personRepository.findByStudyMembershipsRole(r));
        persons.addAll(personRepository.findByNetworkMembershipsRole(r));
        persons.forEach(p -> {
            p.removeAllMemberships(r);
            personRepository.save(p);
            eventBus.post(new PersonUpdatedEvent(p));
        });
    });
}

From source file:org.ow2.proactive.connector.iaas.cache.InstanceCache.java

public void registerInfrastructureInstances(Infrastructure infrastructure, Set<Instance> instances) {
    Map<String, Set<Instance>> tempInstances = cloneCreatedInstances();
    tempInstances.putIfAbsent(infrastructure.getId(), Sets.newHashSet());
    Set<Instance> cachedInstances = tempInstances.get(infrastructure.getId());
    cachedInstances.addAll(instances);
    tempInstances.put(infrastructure.getId(), cachedInstances);
    createdInstances = ImmutableMap.copyOf(tempInstances);
}

From source file:fi.helsinki.opintoni.service.CourseService.java

public Set<CourseDto> getCourses(Optional<String> studentNumber, Optional<String> teacherNumber,
        Locale locale) {// www .  jav  a 2s  .co m
    Set<CourseDto> courseDtos = new HashSet<>();

    teacherNumber.ifPresent(number -> courseDtos.addAll(getTeacherCourses(number, locale)));

    studentNumber.ifPresent(number -> courseDtos.addAll(getStudentCourses(number, locale)));

    return courseDtos;
}

From source file:org.zlogic.vogon.web.controller.ConfigurationController.java

/**
 * Returns configuration properties/*from  w w  w.  j  a v a 2s .  c om*/
 *
 * @return the configuration properties
 */
@RequestMapping(method = RequestMethod.GET, produces = "application/json")
//@PreAuthorize("hasAuthority('" + VogonSecurityUser.AUTHORITY_ADMIN + "')") //NOI18N
@Secured({ VogonSecurityUser.AUTHORITY_ADMIN })
public @ResponseBody Collection<ConfigurationElement> getProperties() {
    Set<ConfigurationElement> configuration = new HashSet<>(configurationRepository.findAll());
    configuration.addAll(ConfigurationKeys.DEFAULT_VALUES);//Will only add missing values
    return configuration;
}

From source file:org.obiba.mica.web.model.SetDtos.java

Mica.SetOperationDto asDto(SetOperation setOperation) {
    Set<String> operands = Sets.newLinkedHashSet();
    setOperation.getCompositions().forEach(set -> operands.addAll(set.getOperands()));
    Mica.SetOperationDto.Builder builder = Mica.SetOperationDto.newBuilder().setId(setOperation.getId())
            .setType(setOperation.getType()).addAllSets(operands);
    setOperation.getCompositions().forEach(set -> builder.addCompositions(asDto(setOperation, set)));
    return builder.build();
}

From source file:hr.fer.spocc.automaton.fsm.AbstractNondeterministicFiniteAutomaton.java

/**
 * Vraca skup stanja koji predstavlja neposrednu okolinu. 
 * Ova metoda ne uzima u obzir -okolinu; za to koristite metodu 
 * {@link #powerSet(Set)} nakon/prije ove.
 * /* w  w w  .  j av a 2s  . c o m*/
 * @param input ulazni znak
 * @param states skup stanja iz kojih se razmatra prijelaz
 * @return skup stanja koji se dobije tocno jednim prijelazom iz
 * pocetnih stanja
 */
protected Set<State> getNextStates(T input, Set<State> states) {
    Set<State> ret = new HashSet<State>();
    for (State state : states) {
        ret.addAll(getNextStates(input, state));
    }
    return ret;
}

From source file:ar.com.zauber.commons.repository.BaseEntity.java

/**
 * @param theClass/*ww  w  .  j a va  2s.  c  o  m*/
 * @return
 */
private static Set<Field> getIdentityFields(final Class<?> theClass) {
    Set<Field> fields = new HashSet<Field>();
    if (theClass.getAnnotation(IdentityProperties.class) != null) {
        String[] fieldNamesArray = theClass.getClass().getAnnotation(IdentityProperties.class).fieldNames();
        for (int i = 0; i < fieldNamesArray.length; i++) {
            try {
                fields.add((theClass.getField(fieldNamesArray[i])));
            } catch (final SecurityException e) {
                throw new IllegalStateException(e);
            } catch (final NoSuchFieldException e) {
                throw new IllegalStateException(e);
            }

        }
    } else {
        Field[] fieldsArray = theClass.getFields();
        for (int i = 0; i < fieldsArray.length; i++) {
            if (fieldsArray[i].getAnnotation(IdentityProperty.class) != null) {
                fields.add(fieldsArray[i]);
            }
        }
        if (!theClass.getSuperclass().equals(Object.class)) {
            fields.addAll(getIdentityFields(theClass.getSuperclass()));
        }
    }
    return fields;
}

From source file:com.greenline.hrs.admin.user.service.ManUserService.java

/**
 * /*from   w w w. ja v  a 2  s.  com*/
 *
 * @param uid
 * @return ?????null.
 */
public UserAuthInfo getUserAuthInfo(long uid) {
    UserAuthInfo userAuthInfo = new UserAuthInfo(String.valueOf(uid));
    Set<Integer> groupIds = manUserGroupBiz.getGroupIdsByUid(uid);
    Set<Integer> roleIds = manGroupRoleBiz.getRoleIdsByGroupIds(groupIds);
    roleIds.addAll(manUserRoleBiz.getRoleIdsByUid(uid));
    if (!roleIds.isEmpty()) {
        for (Integer roleId : roleIds) {
            userAuthInfo.addRole(roleId.toString());
        }
        Set<Integer> permissionIds = manRoleResourceBiz.getResourceIdsByRoleIds(roleIds);
        Set<String> permissions = manResourceBiz.getPermissionByIds(permissionIds);
        userAuthInfo.setPermissions(permissions);
    }

    return userAuthInfo;
}