List of usage examples for java.util ArrayList addAll
public boolean addAll(Collection<? extends E> c)
From source file:com.searchbox.framework.service.SearchAdapterService.java
public void doAdapt(SearchAdapter.Time time, Class<?> requiredArg, Object... objects) { ArrayList<Object> arguments = new ArrayList<Object>(); arguments.addAll(Arrays.asList(objects)); Long start = System.currentTimeMillis(); this.doAdapt(requiredArg, this.searchAdapterMethods.get(time), arguments); LOGGER.info("DoAdapt[{}] done in {}ms", time, (System.currentTimeMillis() - start)); }
From source file:com.thoughtworks.gauge.maven.GaugeExecutionMojo.java
private void addAdditionalFlags(ArrayList<String> command) { if (flags != null) { command.addAll(flags); } }
From source file:com.uber.network.JsonNode.java
@Override public ArrayList<DataNode> getChildren() { final ArrayList<DataNode> dataNodes = new ArrayList<DataNode>(); if (mValue instanceof JSONArray) { dataNodes.addAll(getArray()); } else if (mValue instanceof JSONObject) { final JSONObject jsonObject = (JSONObject) mValue; final Iterator<?> keys = jsonObject.keys(); while (keys.hasNext()) { final String key = (String) keys.next(); final DataNode node = getNode(key); if (node != null) { dataNodes.add(node);/*ww w .j a v a 2s . co m*/ } } } return dataNodes; }
From source file:au.com.identityconcepts.shibboleth.test.TestCaseBase.java
/** * Creates a Spring application context from the given configurations and any instance registered configurations. * //from w w w .j av a2 s .c o m * @param configs spring configuration files to be located on the classpath * * @return the configured spring context * * @throws ResourceException thrown if the given resources can not be located */ protected ApplicationContext createSpringContext(String[] configs) throws ResourceException { ArrayList<Resource> resources = new ArrayList<Resource>(); resources.addAll(configResources); if (configs != null) { for (String config : configs) { resources.add(new ClasspathResource(config)); } } return createSpringContext(resources); }
From source file:com.appsimobile.appsii.iab.IabInventoryHelper.java
int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus) throws RemoteException, JSONException { logDebug("Querying SKU details."); ArrayList<String> skuList = new ArrayList<>(); skuList.addAll(inv.getAllOwnedSkus(itemType)); if (moreSkus != null) skuList.addAll(moreSkus);//from w ww .j a v a2 s . c o m if (skuList.size() == 0) { logDebug("queryPrices: nothing to do because there are no SKUs."); return BILLING_RESPONSE_RESULT_OK; } Bundle querySkus = new Bundle(); querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList); Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), itemType, querySkus); if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) { int response = getResponseCodeFromBundle(skuDetails); if (response != BILLING_RESPONSE_RESULT_OK) { logDebug("getSkuDetails() failed: " + getResponseDesc(response)); return response; } else { logError("getSkuDetails() returned a bundle with neither an error nor a detail " + "list."); return IABHELPER_BAD_RESPONSE; } } ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST); int N = responseList.size(); for (int i = 0; i < N; i++) { String thisResponse = responseList.get(i); SkuDetails d = new SkuDetails(itemType, thisResponse); logDebug("Got sku details: " + d); inv.addSkuDetails(d); } return BILLING_RESPONSE_RESULT_OK; }
From source file:org.springframework.cloud.aws.messaging.listener.QueueMessageHandler.java
@Override protected List<? extends HandlerMethodReturnValueHandler> initReturnValueHandlers() { ArrayList<HandlerMethodReturnValueHandler> handlers = new ArrayList<>(); handlers.addAll(this.getCustomReturnValueHandlers()); return handlers; }
From source file:com.sap.prd.mobile.ios.mios.XCodePackageXcodeprojMojo.java
private void zip(List<String> zipCommandParts, Collection<String> includes, Collection<String> excludes) throws IOException, MojoExecutionException { ArrayList<String> zipCmdCall = new ArrayList<String>(); zipCmdCall.addAll(zipCommandParts); zipCmdCall.addAll(includes);/* www . j a v a 2s. c om*/ if (excludes != null && !excludes.isEmpty()) { zipCmdCall.add("-x"); zipCmdCall.addAll(excludes); } getLog().info("Executing: " + StringUtils.join(zipCmdCall, ' ')); int exitCode = Forker.forkProcess(System.out, project.getBasedir(), zipCmdCall.toArray(new String[] {})); if (exitCode != 0) { throw new MojoExecutionException( "Could not package the Xcode project with all its dependencies into a zip file."); } }
From source file:ninja.eivind.hotsreplayuploader.versions.ReleaseManager.java
private List<GitHubRelease> getLatest() throws IOException { final ArrayList<GitHubRelease> releases = new ArrayList<>(); final String apiUrl = getAllReleasesString(); final String response = httpClient.simpleRequest(apiUrl); releases.addAll(Arrays.asList(objectMapper.readValue(response, GitHubRelease[].class))); return releases; }
From source file:com.addthis.metrics.reporter.config.AbstractHostPortReporterConfig.java
public List<HostPort> getHostListAndStringList() { // some simple log valadatin' sinc we can't || the @NotNulls // make mini protected functions sans logging for Ganglia if (getHosts() == null && getHostsString() == null) { log.warn("No hosts specified as a list or delimited string"); return null; }// w w w . java 2 s. c om if (getHosts() != null && getHostsString() != null) { log.warn("Did you really mean to have hosts as a list and delimited string?"); } ArrayList<HostPort> combinedHosts = new ArrayList<HostPort>(); if (getHosts() != null) { combinedHosts.addAll(getHosts()); } if (getHostsString() != null) { combinedHosts.addAll(parseHostString()); } return combinedHosts; }
From source file:org.openspaces.security.ldap.ActiveDirectorySpringSecurityManager.java
/** * Attempts to authenticate the passed {@link UserDetails} object, returning a fully populated * {@link Authentication} object (including granted authorities) if successful. * <p>/* ww w . ja va2 s . c o m*/ * This call will utilioze the Group mapper factory to create a collection of XAP authorities * from a collection of "GrantedAuthority" (memberOf in Active Directory). * * @param userDetails The GigaSpaces user details request object * @return a fully authenticated object including authorities * @throws AuthenticationException if authentication fails */ public Authentication authenticate(UserDetails userDetails) throws AuthenticationException { try { org.springframework.security.core.Authentication authenticate = authenticationManager .authenticate(createAuthenticationRequest(userDetails)); if (!authenticate.isAuthenticated()) { throw new AuthenticationException( "Authentication failed for user [" + userDetails.getUsername() + "]"); } // Create a list to hold granted authorities fetched from Active Directory Collection<? extends GrantedAuthority> grantedAuthorities = authenticate.getAuthorities(); ArrayList<Authority> authoritiesList = new ArrayList<Authority>(); authoritiesList .addAll(GroupMapperAuthorityFactory.create(grantedAuthorities, groupMapper.getGroupMap())); if (authoritiesList.size() < 1) { throw new AuthenticationException("Authentication failed for user [" + userDetails.getUsername() + "]; User does not belong to any authority"); } User user = new User(userDetails.getUsername(), userDetails.getPassword(), authoritiesList.toArray(new Authority[authoritiesList.size()])); Authentication authentication = new Authentication(user); return authentication; } catch (Exception exception) { if (logger.isLoggable(Level.FINEST)) { logger.log(Level.FINEST, "Caught exception upon authentication: " + exception, exception); } throw new AuthenticationException(exception); } }