List of usage examples for java.util List addAll
boolean addAll(Collection<? extends E> c);
From source file:Main.java
private static List<Field> getAllFields(List<Field> fields, Class<?> type) { fields.addAll(Arrays.asList(type.getDeclaredFields())); if (type.getSuperclass() != null) { fields = getAllFields(fields, type.getSuperclass()); }/*from w w w. j av a 2 s . c o m*/ return fields; }
From source file:net.javacrumbs.smock.springws.client.SmockClient.java
/** * Creates a {@code MockWebServiceServer} instance based on the given {@link WebServiceTemplate}. * Supports interceptors that will be applied on the incomming message. Please note that acctually the interceptoes will * be added to the {@link ClientInterceptor} set on the client side. it's an ugly hack, but that's the only way to do it * without reimplementing the whole testing library. I hope it will change in next releases. *//from www. j a v a 2 s . c o m * @param webServiceTemplate the web service template * @return the created server */ public static MockWebServiceServer createServer(WebServiceTemplate webServiceTemplate, EndpointInterceptor[] interceptors) { if (interceptors != null && interceptors.length > 0) { List<ClientInterceptor> newInterceptors = new ArrayList<ClientInterceptor>(); if (webServiceTemplate.getInterceptors() != null) { newInterceptors.addAll(Arrays.asList(webServiceTemplate.getInterceptors())); } newInterceptors .addAll(Arrays.asList(EndpointInterceptorClientAdapter.wrapEndpointInterceptors(interceptors))); webServiceTemplate .setInterceptors(newInterceptors.toArray(new ClientInterceptor[newInterceptors.size()])); } return MockWebServiceServer.createServer(webServiceTemplate); }
From source file:Main.java
public static <T> List<T> merge(List<T> c1, List<T> c2) { if (c1 == null || c1.size() == 0) { return c2; }// ww w . j a v a 2 s. c om if (c2 == null || c2.size() == 0) { return c1; } List<T> all = new ArrayList<T>(c1.size() + c2.size()); all.addAll(c1); all.addAll(c2); return all; }
From source file:io.fabric8.core.jmx.BeanUtils.java
public static List<String> fetchConfigurations(Profile self) { List<String> answer = new ArrayList<String>(); answer.addAll(self.getFileConfigurations().keySet()); return answer; }
From source file:com.google.mr4c.sources.SourceTestUtils.java
public static void compareSources(ArchiveSource expectedSrc, FileSource actualSrc) throws IOException { List<String> expectedFiles = new ArrayList<String>(expectedSrc.getAllFileNames()); List<String> actualFiles = new ArrayList<String>(actualSrc.getAllFileNames()); List<String> expectedMetaFiles = new ArrayList<String>(expectedSrc.getAllMetadataFileNames()); List<String> allExpectedFiles = new ArrayList<String>(expectedFiles); allExpectedFiles.addAll(expectedMetaFiles); Collections.sort(allExpectedFiles); Collections.sort(actualFiles); assertEquals("checking same set of file names", allExpectedFiles, actualFiles); for (String fileName : expectedFiles) { DataFileSource expectedFile = expectedSrc.getFileSource(fileName); DataFileSource actualFile = actualSrc.getFileSource(fileName); compareFiles(expectedFile, actualFile); }/* ww w.ja va 2 s .c o m*/ for (String fileName : expectedMetaFiles) { DataFileSource expectedFile = expectedSrc.getMetadataFileSource(fileName); DataFileSource actualFile = actualSrc.getFileSource(fileName); compareFiles(expectedFile, actualFile); } }
From source file:com.mxep.web.common.persistence.DynamicSpecifications.java
public static <T> Specification<T> bySearchFilter(final Collection<SearchFilter> filters, final Class<T> entityClazz, final SpecificationCallback<T> callback) { return new Specification<T>() { @Override//from ww w . java 2 s.c o m public Predicate toPredicate(Root<T> root, CriteriaQuery<?> query, CriteriaBuilder builder) { if (Collections3.isNotEmpty(filters)) { List<Predicate> predicates = getPredicate(filters, root, query, builder); if (null != callback) { predicates.addAll(callback.addPredicate(root, query, builder)); } // ? and ??? if (!predicates.isEmpty()) { return builder.and(predicates.toArray(new Predicate[predicates.size()])); } } return builder.conjunction(); } }; }
From source file:de.iteratec.iteraplan.businesslogic.exchange.common.informationflow.InformationFlowGeneralHelper.java
public static List<String> getReferencedTcReleaseNames(InformationSystemInterface connection) { List<TechnicalComponentRelease> tcReleases = new ArrayList<TechnicalComponentRelease>(); tcReleases.addAll(connection.getTechnicalComponentReleases()); List<String> referencedTcrs = new ArrayList<String>(); if (tcReleases.size() > 0) { for (TechnicalComponentRelease tcr : tcReleases) { if (StringUtils.isNotEmpty(tcr.getNonHierarchicalName())) { referencedTcrs.add(tcr.getNonHierarchicalName()); }//ww w .j a va 2 s .com } } return referencedTcrs; }
From source file:com.googlecode.jsonschema2pojo.integration.util.CodeGenerationHelper.java
public static ClassLoader compile(File sourceDirectory, List<String> classpath) { List<String> fullClasspath = new ArrayList<String>(); fullClasspath.addAll(classpath); fullClasspath.add(System.getProperty("java.class.path")); new Compiler().compile(sourceDirectory, join(fullClasspath, File.pathSeparatorChar)); try {//from w ww. j av a2s. co m return URLClassLoader.newInstance(new URL[] { sourceDirectory.toURI().toURL() }, Thread.currentThread().getContextClassLoader()); } catch (MalformedURLException e) { throw new RuntimeException(e); } }
From source file:de.unisb.cs.st.javalanche.mutation.run.task.MutationTaskCreator.java
/** * Generates given number of mutation task, where each task consists of a * given number of mutations. Note: The MutationProperties.PROJECT_PREFIX * variable has to be set./*from w w w . ja v a2 s . c o m*/ * * @param numberOfTasks * number of tasks that should be created * @param mutationsPerTask * number of mutations per task * @throws IOException */ public static void createMutationTasks(int numberOfTasks, int mutationsPerTask) throws IOException { String prefix = ConfigurationLocator.getJavalancheConfiguration().getProjectPrefix(); int numberOfIds = numberOfTasks * mutationsPerTask; List<Long> mutationIds = getMutations(prefix, numberOfIds); Collections.shuffle(mutationIds); int i = 1; for (; i <= numberOfTasks; i++) { List<Long> idsForTask = new ArrayList<Long>(); if (mutationIds.size() >= mutationsPerTask) { idsForTask.addAll(mutationIds.subList(0, mutationsPerTask)); } else { logger.info("Not enough mutations fetched from db"); idsForTask.addAll(mutationIds); } mutationIds.removeAll(idsForTask); if (idsForTask.size() > 0) { writeListToFile(idsForTask, i, numberOfTasks); } else { logger.info("No more mutations. Finishing after file " + (i - 1)); break; } } i = i - 1; System.out.println("Created " + i + " mutation tasks"); }
From source file:net.ageto.gyrex.impex.persistence.cassandra.CassandraModelManagerMetrics.java
private static BaseMetric[] combineWithMyMetrics(final BaseMetric... metrics) { final List<BaseMetric> combinedMetrics = new ArrayList<BaseMetric>(); if ((null != metrics) && (metrics.length > 0)) { combinedMetrics.addAll(Arrays.asList(metrics)); }// w ww . j av a2 s . c o m combinedMetrics.add(new ThroughputMetric("findById")); combinedMetrics.add(new ThroughputMetric("findByAttribute")); combinedMetrics.add(new ThroughputMetric("persist")); combinedMetrics.add(new ThroughputMetric("delete")); combinedMetrics.add(new ThroughputMetric("query")); combinedMetrics.add(new ThroughputMetric("transactions")); combinedMetrics.add(new ErrorMetric("errors", 0)); return combinedMetrics.toArray(new BaseMetric[combinedMetrics.size()]); }