java.util.List#addAll ( )源码实例Demo

下面列出了java.util.List#addAll ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netbeans   文件: ImportantFilesImpl.java
@Override
public Collection<FileInfo> getFiles() {
    PhpModule phpModule = PhpModule.Factory.lookupPhpModule(project);
    if (phpModule == null) {
        return Collections.emptyList();
    }
    if (!initialized) {
        initialized = true;
        CodeceptionPreferences.addPreferenceChangeListener(phpModule, WeakListeners.create(PreferenceChangeListener.class, this, CodeceptionPreferences.class));
    }

    // global configuration
    List<FileInfo> files = new ArrayList<>();
    files.addAll(defaultConfigSupport.getFiles(null));
    if (CodeceptionPreferences.isCustomCodeceptionYmlEnabled(phpModule)) {
        List<FileObject> codeceptionYmls = Codecept.getCodeceptionYmls(phpModule);
        for (FileObject codeceptionYml : codeceptionYmls) {
            files.add(new FileInfo(codeceptionYml));
        }
    }
    return files;
}
 
源代码2 项目: flink   文件: DatadogHttpReporter.java
@Override
public void notifyOfAddedMetric(Metric metric, String metricName, MetricGroup group) {
	final String name = group.getMetricIdentifier(metricName);

	List<String> tags = new ArrayList<>(configTags);
	tags.addAll(getTagsFromMetricGroup(group));
	String host = getHostFromMetricGroup(group);

	if (metric instanceof Counter) {
		Counter c = (Counter) metric;
		counters.put(c, new DCounter(c, name, host, tags));
	} else if (metric instanceof Gauge) {
		Gauge g = (Gauge) metric;
		gauges.put(g, new DGauge(g, name, host, tags));
	} else if (metric instanceof Meter) {
		Meter m = (Meter) metric;
		// Only consider rate
		meters.put(m, new DMeter(m, name, host, tags));
	} else if (metric instanceof Histogram) {
		LOGGER.warn("Cannot add {} because Datadog HTTP API doesn't support Histogram", metricName);
	} else {
		LOGGER.warn("Cannot add unknown metric type {}. This indicates that the reporter " +
			"does not support this metric type.", metric.getClass().getName());
	}
}
 
源代码3 项目: redisson   文件: RedissonConnection.java
@Override
public Long zUnionStore(byte[] destKey, Aggregate aggregate, Weights weights, byte[]... sets) {
    List<Object> args = new ArrayList<Object>(sets.length*2 + 5);
    args.add(destKey);
    args.add(sets.length);
    args.addAll(Arrays.asList(sets));
    if (weights != null) {
        args.add("WEIGHTS");
        for (double weight : weights.toArray()) {
            args.add(BigDecimal.valueOf(weight).toPlainString());
        }
    }
    if (aggregate != null) {
        args.add("AGGREGATE");
        args.add(aggregate.name());
    }
    return write(destKey, LongCodec.INSTANCE, ZUNIONSTORE, args.toArray());
}
 
源代码4 项目: netbeans   文件: JDBCStubUtil.java
public static ResultSet primaryKeysResultSet(String[] pkNames, String[] columnNames, short[] keySeqs) {
    List pkNameColumn = writeableSingletonList("PK_NAME");
    pkNameColumn.addAll(Arrays.asList(pkNames));
    
    List columnNameColumn = writeableSingletonList("COLUMN_NAME");
    columnNameColumn.addAll(Arrays.asList(columnNames));
    
    List keySeqColumn = writeableSingletonList("KEY_SEQ");
    addAllAsReferenceType(keySeqColumn, keySeqs);
    
    List columns = new ArrayList();
    columns.add(pkNameColumn);
    columns.add(columnNameColumn);
    columns.add(keySeqColumn);
    return createResultSet(columns);
}
 
源代码5 项目: helidon-build-tools   文件: SourcePath.java
private static List<SourcePath> doScan(File root, File dir) {
    List<SourcePath> sourcePaths = new ArrayList<>();
    DirectoryStream<Path> dirStream = null;
    try {
        dirStream = Files.newDirectoryStream(dir.toPath());
        Iterator<Path> it = dirStream.iterator();
        while (it.hasNext()) {
            Path next = it.next();
            if (Files.isDirectory(next)) {
                sourcePaths.addAll(doScan(root, next.toFile()));
            } else {
                sourcePaths.add(new SourcePath(root, next.toFile()));
            }
        }
    } catch (IOException ex) {
        if (dirStream != null) {
            try {
                dirStream.close();
            } catch (IOException e) { }
        }
    }
    return sort(sourcePaths);
}
 
源代码6 项目: lams   文件: ContentNegotiatingViewResolver.java
private List<View> getCandidateViews(String viewName, Locale locale, List<MediaType> requestedMediaTypes)
		throws Exception {

	List<View> candidateViews = new ArrayList<View>();
	for (ViewResolver viewResolver : this.viewResolvers) {
		View view = viewResolver.resolveViewName(viewName, locale);
		if (view != null) {
			candidateViews.add(view);
		}
		for (MediaType requestedMediaType : requestedMediaTypes) {
			List<String> extensions = this.contentNegotiationManager.resolveFileExtensions(requestedMediaType);
			for (String extension : extensions) {
				String viewNameWithExtension = viewName + '.' + extension;
				view = viewResolver.resolveViewName(viewNameWithExtension, locale);
				if (view != null) {
					candidateViews.add(view);
				}
			}
		}
	}
	if (!CollectionUtils.isEmpty(this.defaultViews)) {
		candidateViews.addAll(this.defaultViews);
	}
	return candidateViews;
}
 
源代码7 项目: bluima   文件: FilterCoocurrencesByStopwords.java
@Override
public void process(JCas jCas) throws AnalysisEngineProcessException {

	List<Cooccurrence> toRemove = newLinkedList();

	for (Entry<Sentence, Collection<Cooccurrence>> sentenceWithCooc : JCasUtil
			.indexCovered(jCas, Sentence.class, Cooccurrence.class)
			.entrySet()) {

		String sText = sentenceWithCooc.getKey().getCoveredText()
				.toLowerCase();

		if (ABBREV.matcher(sText).matches()
				| STOPLIST.matcher(sText).find()) {
			toRemove.addAll(sentenceWithCooc.getValue());
		}
	}

	// remove
	Cooccurrence[] array = toRemove.toArray(new Cooccurrence[toRemove
			.size()]);
	for (int i = 0; i < array.length; i++) {
		array[i].removeFromIndexes();
	}
}
 
源代码8 项目: GOAi   文件: CommonUtil.java
/**
 * 从深度信息解析精度
 *
 * @param depth  深度
 * @param symbol 币对
 * @return 精度
 */
public static Precision parsePrecisionByDepth(Depth depth, String symbol) {
    int base = 0;
    int count = 0;
    List<Row> rows = depth.getAsks().getList();
    rows.addAll(depth.getBids().getList());
    for (Row r : rows) {
        int c = r.getPrice().scale();
        int b = r.getAmount().scale();
        if (count < c) {
            count = c;
        }
        if (base < b) {
            base = b;
        }
    }
    return new Precision(null, symbol, base, count, null, null,
            null, null, null, null);
}
 
private void updateClasspathList() {
	List<CPListElement> srcelements= fFoldersList.getElements();

	List<CPListElement> cpelements= fClassPathList.getElements();
	int nEntries= cpelements.size();
	// backwards, as entries will be deleted
	int lastRemovePos= nEntries;
	int afterLastSourcePos= 0;
	for (int i= nEntries - 1; i >= 0; i--) {
		CPListElement cpe= cpelements.get(i);
		int kind= cpe.getEntryKind();
		if (isEntryKind(kind)) {
			if (!srcelements.remove(cpe)) {
				cpelements.remove(i);
				lastRemovePos= i;
			} else if (lastRemovePos == nEntries) {
				afterLastSourcePos= i + 1;
			}
		}
	}

	if (!srcelements.isEmpty()) {
		int insertPos= Math.min(afterLastSourcePos, lastRemovePos);
		cpelements.addAll(insertPos, srcelements);
	}

	if (lastRemovePos != nEntries || !srcelements.isEmpty()) {
		fClassPathList.setElements(cpelements);
	}
}
 
源代码10 项目: arcusandroid   文件: ScheduleDnLListController.java
@Override
protected void onSubsystemChanged(ModelChangedEvent event) {

    Set<String> currentChanges = event.getChangedAttributes().keySet();
    Set<String> intersection = Sets.intersection(attributesChanges, currentChanges);
    if (!intersection.isEmpty()) {
        List<String> listAddresses = new ArrayList<>();
        listAddresses.addAll(list(getDnLSubsystem().getPetDoorDevices()));
        listAddresses.addAll(list(getDnLSubsystem().getMotorizedDoorDevices()));
        doorDevices.setAddresses(listAddresses, true);
    }

    super.onSubsystemChanged(event);
}
 
源代码11 项目: swift-t   文件: GlobalContext.java
/**
 * We represent overloaded functions in variable map as a function
 * variable with a union type.  This adds a new type to the union.
 *
 * @param name
 * @param type
 */
private void addOverloadToType(String name, FunctionType type) {
  Var existing = lookupVarUnsafe(name);
  List<Type> alts = new ArrayList<Type>();
  alts.addAll(UnionType.getAlternatives(existing.type()));
  alts.add(type);
  replaceVarUnsafe(name, existing.substituteType(
                      UnionType.makeUnion(alts)));
}
 
源代码12 项目: openjdk-8-source   文件: BandStructure.java
protected void initAttrIndexLimit() {
    for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
        assert(attrIndexLimit[i] == 0);  // decide on it now!
        attrIndexLimit[i] = (haveFlagsHi(i)? 63: 32);
        List<Attribute.Layout> defList = attrDefs.get(i);
        assert(defList.size() == 32);  // all predef indexes are <32
        int addMore = attrIndexLimit[i] - defList.size();
        defList.addAll(Collections.nCopies(addMore, (Attribute.Layout) null));
    }
}
 
源代码13 项目: audit4j-demo   文件: JdbcVetRepositoryImpl.java
/**
 * Refresh the cache of Vets that the ClinicService is holding.
 *
 * @see org.springframework.samples.petclinic.model.service.ClinicService#shouldFindVets()
 */
@Override
public Collection<Vet> findAll() throws DataAccessException {
    List<Vet> vets = new ArrayList<Vet>();
    // Retrieve the list of all vets.
    vets.addAll(this.jdbcTemplate.query(
            "SELECT id, first_name, last_name FROM vets ORDER BY last_name,first_name",
            BeanPropertyRowMapper.newInstance(Vet.class)));

    // Retrieve the list of all possible specialties.
    final List<Specialty> specialties = this.jdbcTemplate.query(
            "SELECT id, name FROM specialties",
            BeanPropertyRowMapper.newInstance(Specialty.class));

    // Build each vet's list of specialties.
    for (Vet vet : vets) {
        final List<Integer> vetSpecialtiesIds = this.jdbcTemplate.query(
                "SELECT specialty_id FROM vet_specialties WHERE vet_id=?",
                new BeanPropertyRowMapper<Integer>() {
                    @Override
                    public Integer mapRow(ResultSet rs, int row) throws SQLException {
                        return Integer.valueOf(rs.getInt(1));
                    }
                },
                vet.getId().intValue());
        for (int specialtyId : vetSpecialtiesIds) {
            Specialty specialty = EntityUtils.getById(specialties, Specialty.class, specialtyId);
            vet.addSpecialty(specialty);
        }
    }
    return vets;
}
 
源代码14 项目: uyuni   文件: SystemMigrateAction.java
protected void setupPageAndFormValues(HttpServletRequest request,
        DynaActionForm daForm, User user, Server s, Org o, Integer trustedOrgCount) {

    //ibm jvm has issues adding set in ArrayList constructor so add separately
    Set set = user.getOrg().getTrustedOrgs();
    List orgList = new ArrayList();
    orgList.addAll(set);

    request.setAttribute("trustedOrgCount", trustedOrgCount);
    request.setAttribute("system", s);
    request.setAttribute("orgs", orgList);
    request.setAttribute("org", o);
}
 
源代码15 项目: pacbot   文件: EntityManager.java
/**
 * Upload entity data.
 *
 * @param datasource            the datasource
 * @return the list
 */
public List<Map<String, String>> uploadEntityData(String datasource) {
	List<Map<String,String>> errorList = new ArrayList<>();
    Set<String> types = ConfigManager.getTypes(datasource);
    Iterator<String> itr = types.iterator();
    String type = "";
    LOGGER.info("*** Start Colleting Entity Info ***");
    List<String> filters = Arrays.asList("_docid", FIRST_DISCOVERED);
    EntityAssociationManager childTypeManager = new EntityAssociationManager();
    while (itr.hasNext()) {
        try {
            type = itr.next();
            Map<String, Object> stats = new LinkedHashMap<>();
        	String loaddate = new SimpleDateFormat("yyyy-MM-dd HH:mm:00Z").format(new java.util.Date());
            stats.put("datasource", datasource);
            stats.put("type", type);
            stats.put("start_time",  new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new java.util.Date()));
            LOGGER.info("Fetching {}" , type);
            String indexName = datasource + "_" + type;
            Map<String, Map<String, String>> currentInfo = ESManager.getExistingInfo(indexName, type, filters);
            LOGGER.info("Existing no of docs : {}" , currentInfo.size());
            
            List<Map<String, Object>> entities = fetchEntitiyInfoFromS3(datasource,type,errorList);
            List<Map<String, String>> tags = fetchTagsForEntitiesFromS3(datasource, type);
            
            LOGGER.info("Fetched from S3");
            if(!entities.isEmpty()){
             List<Map<String, String>> overridableInfo = RDSDBManager.executeQuery(
                     "select updatableFields  from cf_pac_updatable_fields where resourceType ='" + type + "'");
             List<Map<String, String>> overrides = RDSDBManager.executeQuery(
                     "select _resourceid,fieldname,fieldvalue from pacman_field_override where resourcetype = '"
                             + type + "'");
             Map<String, List<Map<String, String>>> overridesMap = overrides.parallelStream()
                     .collect(Collectors.groupingBy(obj -> obj.get("_resourceid")));
             
             String keys = ConfigManager.getKeyForType(datasource, type); 
             String idColumn = ConfigManager.getIdForType(datasource, type);
             String[] keysArray = keys.split(",");
             
             prepareDocs(currentInfo, entities, tags, overridableInfo, overridesMap, idColumn, keysArray, type);
             Map<String,Long> errUpdateInfo = ErrorManager.getInstance(datasource).handleError(indexName,type,loaddate,errorList,true);
             Map<String, Object> uploadInfo = ESManager.uploadData(indexName, type, entities, loaddate);
             stats.putAll(uploadInfo);
             stats.put("errorUpdates", errUpdateInfo);
             errorList.addAll(childTypeManager.uploadAssociationInfo(datasource, type)) ;
             
            } 
            stats.put("total_docs", entities.size());
            stats.put("end_time", new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new java.util.Date()));
            stats.put("newly_discovered",entities.stream().filter(entity->entity.get(DISCOVERY_DATE).equals(entity.get(FIRST_DISCOVERED))).count());
            String statsJson = ESManager.createESDoc(stats);
            ESManager.invokeAPI("POST", "/datashipper/stats", statsJson);
        } catch (Exception e) {
            LOGGER.error("Exception in collecting/uploading data for {}" ,type,e);
            Map<String,String> errorMap = new HashMap<>();
            errorMap.put(ERROR, "Exception in collecting/uploading data for "+type);
            errorMap.put(ERROR_TYPE, WARN);
            errorMap.put(EXCEPTION, e.getMessage());
            errorList.add(errorMap);
        }
       
    }
    LOGGER.info("*** End Colleting Entity Info ***");
    return errorList;
}
 
protected void includeInputInOutput( Object[][] outputRows ) throws KettleException {
  if ( !m_meta.getIncludeInputAsOutput() ) {

    for ( Object[] r : outputRows ) {
      putRow( m_data.m_outputRowMeta, r );
    }

    return;
  }

  List<Object[]> flattenedInputRows = new ArrayList<Object[]>();
  int[]
      rowCounts =
      new int[m_meta.getDoingReservoirSampling() ? m_data.m_reservoirSamplers.size() : m_data.m_frameBuffers.size()];
  // RowMetaInterface[] infoMetas = new RowMetaInterface[rowCounts.length];
  int index = 0;
  int sum = 0;
  if ( !m_meta.getDoingReservoirSampling() ) {
    for ( List<Object[]> frameBuffer : m_data.m_frameBuffers ) {
      sum += frameBuffer.size();
      rowCounts[index++] = sum;
      flattenedInputRows.addAll( frameBuffer );
    }
  } else {
    for ( ReservoirSamplingData reservoirSamplingData : m_data.m_reservoirSamplers ) {
      sum += reservoirSamplingData.getSample().size();
      rowCounts[index++] = sum;
      flattenedInputRows.addAll( reservoirSamplingData.getSample() );
    }
  }

  index = 0;
  for ( int i = 0; i < outputRows.length; i++ ) {
    if ( i > rowCounts[index] ) {
      index++;
    }
    // get the input row meta corresponding to this row
    RowMetaInterface associatedRowMeta = m_data.m_infoMetas.get( index );
    if ( outputRows[i] != null ) {
      Object[] inputRow;
      if ( m_data.m_batchSize == 1 && m_meta.getDoingReservoirSampling() ) {
        inputRow = flattenedInputRows.get( m_data.m_rowByRowReservoirSampleIndex );
      } else {
        inputRow = flattenedInputRows.get( i );
      }
      for ( ValueMetaInterface vm : m_data.m_incomingFieldsIncludedInOutputRowMeta.getValueMetaList() ) {
        int outputIndex = m_data.m_nonScriptOutputMetaIndexLookup.get( vm.getName() );
        // is this user selected input field present in the current info input row set?
        int inputIndex = associatedRowMeta.indexOfValue( vm.getName() );
        if ( inputIndex >= 0 ) {
          outputRows[i][outputIndex] = inputRow[inputIndex];
        }
      }
      putRow( m_data.m_outputRowMeta, outputRows[i] );
    }
  }
}
 
源代码17 项目: jkube   文件: DockerComposeServiceWrapper.java
public List<String> getLinks() {
    List<String> ret = new ArrayList<>();
    ret.addAll(this.<String>asList("links"));
    ret.addAll(this.<String>asList("external_links"));
    return ret;
}
 
源代码18 项目: netbeans   文件: ClassPathProviderImpl.java
private List<FileObject> getPlatformPath() {
    List<FileObject> files = new ArrayList<>();
    files.addAll(getDirs(PhpProjectProperties.INCLUDE_PATH));
    files.addAll(getDirs(PhpProjectProperties.PRIVATE_INCLUDE_PATH));
    return files;
}
 
源代码19 项目: birt   文件: ColumnPageBreakProvider.java
public Object[] getElements( Object inputElement )
{
	// TODO Auto-generated method stub
	input = inputElement;
	Object obj = null;
	if ( inputElement instanceof List )
	{
		obj = ( (List) inputElement ).get( 0 );
	}
	else
	{
		obj = inputElement;
	}

	List list = new ArrayList( );
	if ( !( obj instanceof ExtendedItemHandle ) )
		return EMPTY;
	ExtendedItemHandle element = (ExtendedItemHandle) obj;
	CrosstabReportItemHandle crossTab = null;
	try
	{
		crossTab = (CrosstabReportItemHandle) element.getReportItem( );
	}
	catch ( ExtendedElementException e )
	{
		// TODO Auto-generated catch block
		logger.log( Level.SEVERE, e.getMessage( ), e );
	}
	if ( crossTab == null )
	{
		return list.toArray( );
	}
	// if ( crossTab.getCrosstabView( ICrosstabConstants.COLUMN_AXIS_TYPE )
	// != null )
	// {
	// DesignElementHandle elementHandle = crossTab.getCrosstabView(
	// ICrosstabConstants.COLUMN_AXIS_TYPE )
	// .getModelHandle( );
	// list.addAll( getLevel( (ExtendedItemHandle) elementHandle ) );
	// }

	if ( crossTab.getCrosstabView( ICrosstabConstants.COLUMN_AXIS_TYPE ) != null )
	{
		CrosstabViewHandle crosstabView = crossTab.getCrosstabView( ICrosstabConstants.COLUMN_AXIS_TYPE );
		list.addAll( getLevel( crosstabView ) );
	}

	return list.toArray( );
}
 
源代码20 项目: mapbox-java   文件: TurfMeta.java
/**
 * Private helper method to go with {@link TurfMeta#coordAll(LineString)}.
 *
 * @param coords     the {@code List} of {@link Point}s.
 * @param lineString any {@link LineString} object
 * @return a {@code List} made up of {@link Point}s
 * @since 4.8.0
 */
@NonNull
private static List<Point> coordAll(@NonNull List<Point> coords, @NonNull LineString lineString) {
  coords.addAll(lineString.coordinates());
  return coords;
}