List of usage examples for java.util Set addAll
boolean addAll(Collection<? extends E> c);
From source file:com.evolveum.midpoint.util.MiscUtil.java
public static <T> Collection<? extends T> unionExtends(Collection<? extends T>... sets) { Set<T> resultSet = new HashSet<T>(); for (Collection<? extends T> set : sets) { if (set != null) { resultSet.addAll(set); }/*from w w w . j a v a 2 s . co m*/ } return resultSet; }
From source file:com.redhat.rhn.frontend.action.LoginHelper.java
private static Set<Role> getRolesFromExtGroups(Set<String> groupNames) { Set<Role> roles = new HashSet<Role>(); for (String extGroupName : groupNames) { UserExtGroup extGroup = UserGroupFactory.lookupExtGroupByLabel(extGroupName); if (extGroup == null) { log.info("No role mapping defined for external group '" + extGroupName + "'."); continue; }//from w w w . ja v a2 s . c o m roles.addAll(extGroup.getRoles()); } return roles; }
From source file:net.dv8tion.jda.core.utils.SimpleLog.java
private static Set<File> collectFiles(Level level) { Set<File> out = new HashSet<>(); for (Map.Entry<Level, Set<File>> mapEntry : fileLogs.entrySet()) { if (mapEntry.getKey().getPriority() <= level.getPriority()) out.addAll(mapEntry.getValue()); }/* w ww . j av a 2 s .c o m*/ return out; }
From source file:com.delphix.session.service.ServiceOption.java
public static Set<ServiceOption<?>> supportedOptions() { Set<ServiceOption<?>> supported = new HashSet<ServiceOption<?>>(); supported.addAll(options); return supported; }
From source file:de.jgoldhammer.alfresco.jscript.jmx.JmxDumpUtil.java
/** * Dumps a local or remote MBeanServer's entire object tree for support * purposes. Nested arrays and CompositeData objects in MBean attribute * values are handled./*from www . ja va 2s . co m*/ * * @param connection * the server connection (or server itself) * @param out * PrintWriter to write the output to * @throws IOException * Signals that an I/O exception has occurred. */ public static void dumpConnection(MBeanServerConnection connection, PrintWriter out) throws IOException { JmxDumpUtil.showStartBanner(out); // Get all the object names Set<ObjectName> objectNames = connection.queryNames(null, null); // Sort the names (don't assume ObjectName implements Comparable in JDK // 1.5) Set<ObjectName> newObjectNames = new TreeSet<ObjectName>(new Comparator<ObjectName>() { public int compare(ObjectName o1, ObjectName o2) { return o1.toString().compareTo(o2.toString()); } }); newObjectNames.addAll(objectNames); objectNames = newObjectNames; // Dump each MBean for (ObjectName objectName : objectNames) { try { printMBeanInfo(connection, objectName, out, null); } catch (JMException e) { // Sometimes beans can disappear while we are examining them } } }
From source file:com.qmetry.qaf.automation.step.JavaStepFinder.java
public static Map<String, TestStep> getAllJavaSteps() { Map<String, TestStep> stepMapping = new HashMap<String, TestStep>(); Set<Method> steps = new LinkedHashSet<Method>(); List<String> pkgs = new ArrayList<String>(); pkgs.add(STEPS_PACKAGE);//from w ww. j av a2 s . com if (getBundle().containsKey(STEP_PROVIDER_PKG.key)) { pkgs.addAll(Arrays.asList(getBundle().getStringArray(STEP_PROVIDER_PKG.key))); } for (String pkg : pkgs) { logger.info("pkg: " + pkg); try { List<Class<?>> classes = CLASS_FINDER.getClasses(pkg); steps.addAll(getAllMethodsWithAnnotation(classes, QAFTestStep.class)); } catch (Exception e) { System.err.println("Unable to load steps for package: " + pkg); } } for (Method step : steps) { if (!Modifier.isPrivate(step.getModifiers())) { // exclude private methods. // Case: step provided using QAFTestStepProvider at class level add(stepMapping, new JavaStep(step)); } } return stepMapping; }
From source file:com.evolveum.midpoint.test.util.TestUtil.java
public static <T> void assertSetEquals(String message, Collection<T> actual, T... expected) { Set<T> expectedSet = new HashSet<T>(); expectedSet.addAll(Arrays.asList(expected)); Set<T> actualSet = new HashSet<T>(); actualSet.addAll(actual);//from w ww . j a v a 2 s . co m if (message != null) { assertEquals(message, expectedSet, actualSet); } else { assertEquals(expectedSet, actualSet); } }
From source file:io.github.moosbusch.lumpi.util.LumpiUtil.java
public static <T> Set<T> asSet(T[] values) { Set<T> result = new HashSet<>(); if (ArrayUtils.isNotEmpty(values)) { result.addAll(Arrays.asList(values)); }/*from ww w. ja va2 s.co m*/ return result; }
From source file:gov.nasa.ensemble.core.plan.advisor.view.PlanAdvisorPage.java
private static Set<Object> getSelectedObjects(ISelection planElementsSelection, ISelection viewerSelection) { Set<Object> selected = new HashSet<Object>(); if (planElementsSelection instanceof IStructuredSelection) { selected.addAll(((IStructuredSelection) planElementsSelection).toList()); }/*from ww w. j av a2 s . c om*/ if (viewerSelection instanceof IStructuredSelection) { for (Object object : ((IStructuredSelection) viewerSelection).toList()) { if (object instanceof ViolationTracker) { Violation violation = ((ViolationTracker) object).getViolation(); selected.add(violation); } } } return selected; }
From source file:com.redhat.rhn.frontend.action.LoginHelper.java
private static Set<ServerGroup> getSgsFromExtGroups(Set<String> groupNames, Org org) { Set<ServerGroup> sgs = new HashSet<ServerGroup>(); for (String extGroupName : groupNames) { OrgUserExtGroup extGroup = UserGroupFactory.lookupOrgExtGroupByLabelAndOrg(extGroupName, org); if (extGroup == null) { log.info("No sg mapping defined for external group '" + extGroupName + "'."); continue; }/*from www. ja v a 2 s .c o m*/ sgs.addAll(extGroup.getServerGroups()); } return sgs; }