当前位置: 首页>>代码示例>>Java>>正文


Java Collection.addAll方法代码示例

本文整理汇总了Java中java.util.Collection.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java Collection.addAll方法的具体用法?Java Collection.addAll怎么用?Java Collection.addAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Collection的用法示例。


在下文中一共展示了Collection.addAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAllFrames

import java.util.Collection; //导入方法依赖的package包/类
private static Collection<JInternalFrame> getAllFrames(Container parent) {
    int i, count;
    Collection<JInternalFrame> results = new LinkedHashSet<>();
    count = parent.getComponentCount();
    for (i = 0; i < count; i++) {
        Component next = parent.getComponent(i);
        if (next instanceof JInternalFrame) {
            results.add((JInternalFrame) next);
        } else if (next instanceof JInternalFrame.JDesktopIcon) {
            JInternalFrame tmp = ((JInternalFrame.JDesktopIcon) next).getInternalFrame();
            if (tmp != null) {
                results.add(tmp);
            }
        } else if (next instanceof Container) {
            results.addAll(getAllFrames((Container) next));
        }
    }
    return results;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:JDesktopPane.java

示例2: get

import java.util.Collection; //导入方法依赖的package包/类
/**
 * Get all of the ParameterMapping for this StmtParameter, regardless of the catalog_stmt_index
 * @param catalog_stmt
 * @param catalog_stmt_param
 * @return
 */
protected Collection<ParameterMapping> get(Statement catalog_stmt, StmtParameter catalog_stmt_param) {
    assert(catalog_stmt != null);
    assert(catalog_stmt_param != null);
    
    Collection<ParameterMapping> set = new TreeSet<ParameterMapping>();
    StatementMappings mappings = this.stmtIndex.get(catalog_stmt);
    if (mappings != null) {
        for (SortedMap<StmtParameter, SortedSet<ParameterMapping>> m : mappings.values()) {
            if (m.containsKey(catalog_stmt_param)) {
                set.addAll(m.get(catalog_stmt_param));
            }
        } // FOR
    }
    return (set);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:22,代码来源:ParameterMappingsSet.java

示例3: read

import java.util.Collection; //导入方法依赖的package包/类
@Override
public Collection<Relay.Bundle> read(Uuid teamId, Secret teamSecret, Uuid root, int range) {

  final Collection<Relay.Bundle> result = new ArrayList<>();

  try (final Connection connection = source.connect()) {

    Serializers.INTEGER.write(connection.out(), NetworkCode.RELAY_READ_REQUEST);
    Uuid.SERIALIZER.write(connection.out(), teamId);
    Secret.SERIALIZER.write(connection.out(), teamSecret);
    Uuid.SERIALIZER.write(connection.out(), root);
    Serializers.INTEGER.write(connection.out(), range);

    if (Serializers.INTEGER.read(connection.in()) == NetworkCode.RELAY_READ_RESPONSE) {
      result.addAll(Serializers.collection(BUNDLE_SERIALIZER).read(connection.in()));
    } else {
      LOG.error("Server did not handle RELAY_READ_REQUEST");
    }
  } catch (Exception ex) {
    LOG.error(ex, "Unexpected error when sending RELAY_READ_REQUEST");
  }

  return result;
}
 
开发者ID:EVelez79,项目名称:CodeU-ProjectGroup6,代码行数:25,代码来源:RemoteRelay.java

示例4: pruneInvalidMessages

import java.util.Collection; //导入方法依赖的package包/类
/**
 * Sorts any invalid messages by moving them from the msgList. The net result
 * is a new list returned containing the invalid messages and a pruned msgList
 * containing only those messages that are valid for the given role of the controller
 * and OpenFlow version of the switch.
 * 
 * @param msgList the list of messages to sort
 * @param valid the list of valid messages (caller must allocate)
 * @param swVersion the OFVersion of the switch
 * @param isSlave true if controller is slave; false otherwise
 * @return list of messages that are not valid, removed from input parameter msgList
 */
protected static Collection<OFMessage> pruneInvalidMessages(Iterable<OFMessage> msgList, Collection<OFMessage> valid, OFVersion swVersion, boolean isActive) {
	if (isActive) { /* master or equal/other support all */
		valid.addAll(IterableUtils.toCollection(msgList));
		return Collections.emptyList();
	} else { /* slave */
		Set<OFType> invalidSlaveMsgs = invalidSlaveMsgsByOFVersion.get(swVersion);
		List<OFMessage> invalid = new ArrayList<OFMessage>();
		Iterator<OFMessage> itr = msgList.iterator();
		while (itr.hasNext()) {
			OFMessage m = itr.next();
			if (invalidSlaveMsgs.contains(m.getType())) {
				invalid.add(m);
			} else {
				valid.add(m);
			}
		}

		return invalid;
	}
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:33,代码来源:OFSwitch.java

示例5: handleGetCollidingDutyRosterTurns

import java.util.Collection; //导入方法依赖的package包/类
@Override
protected Collection<DutyRosterTurnOutVO> handleGetCollidingDutyRosterTurns(
		AuthenticationVO auth, Long courseParticipationStatusEntryId, Boolean isRelevantForCourseAppointments) throws Exception {
	CourseParticipationStatusEntry courseParticipationStatusEntry = CheckIDUtil.checkCourseParticipationStatusEntryId(courseParticipationStatusEntryId,
			this.getCourseParticipationStatusEntryDao());
	Collection collidingDutyRosterTurns = new HashSet(); // ArrayList();
	Long staffId = courseParticipationStatusEntry.getStaff().getId();
	DutyRosterTurnDao dutyRosterTurnDao = this.getDutyRosterTurnDao();
	Iterator<InventoryBooking> it = this.getInventoryBookingDao()
			.findByCourseSorted(courseParticipationStatusEntry.getCourse().getId(), isRelevantForCourseAppointments, false).iterator();
	while (it.hasNext()) {
		InventoryBooking courseInventoryBooking = it.next();
		collidingDutyRosterTurns.addAll(dutyRosterTurnDao.findByStaffTrialCalendarInterval(staffId, null, null, courseInventoryBooking.getStart(),
				courseInventoryBooking.getStop()));
	}
	dutyRosterTurnDao.toDutyRosterTurnOutVOCollection(collidingDutyRosterTurns);
	return new ArrayList<DutyRosterTurnOutVO>(collidingDutyRosterTurns);
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:19,代码来源:CourseServiceImpl.java

示例6: mapEdges

import java.util.Collection; //导入方法依赖的package包/类
Collection<ResourceDemandEntry> mapEdges(
		SubstrateNetwork sNetwork,
		VirtualNetwork vNetwork,
		MappingCandidate<VirtualNode, SubstrateNode> candidate,
		NodeLinkMapping m,
		Collection<ResourceDemandEntry> demandedNodeEnergyResource,
		int epsilon) {

	Collection<ResourceDemandEntry> out = mapOutEdges(
			sNetwork, vNetwork, candidate, m, epsilon);
	if (out == null) {
		return null;
	}
	Collection<ResourceDemandEntry> in = mapInEdges(
			sNetwork, vNetwork, candidate, m, epsilon);
	if (in == null) {
		Utils.freeResources(out);
		return null;
	}

	out.addAll(in);
	return out;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:24,代码来源:OptimalMappingsAlgorithm.java

示例7: getEndpoints

import java.util.Collection; //导入方法依赖的package包/类
protected Collection<Endpoint> getEndpoints ( final EquinoxApplication app )
{
    final Collection<Endpoint> result = new LinkedList<> ();

    if ( app == null )
    {
        return result;
    }

    for ( final Exporter exporter : app.getExporter () )
    {
        result.addAll ( exporter.getEndpoints () );
    }

    return result;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:DataComponentGenerator.java

示例8: sendCurrentView

import java.util.Collection; //导入方法依赖的package包/类
void sendCurrentView() {
  NetView v = currentView;
  if (v != null) {
    InstallViewMessage msg = new InstallViewMessage(v,
        services.getAuthenticator().getCredentials(localAddress), false);
    Collection<InternalDistributedMember> recips =
        new ArrayList<>(v.size() + v.getCrashedMembers().size());
    recips.addAll(v.getMembers());
    recips.remove(localAddress);
    recips.addAll(v.getCrashedMembers());
    msg.setRecipients(recips);
    // use sendUnreliably since we are sending to crashed members &
    // don't want any retransmission tasks set up for them
    services.getMessenger().sendUnreliably(msg);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:17,代码来源:GMSJoinLeave.java

示例9: testToArray_threadSafe

import java.util.Collection; //导入方法依赖的package包/类
public void testToArray_threadSafe() {
  for (int delta : new int[] { +1, 0, -1 }) {
    for (int i = 0; i < VALUES.length; i++) {
      List<Character> list = Chars.asList(VALUES).subList(0, i);
      Collection<Character> misleadingSize =
          Helpers.misleadingSizeCollection(delta);
      misleadingSize.addAll(list);
      char[] arr = Chars.toArray(misleadingSize);
      assertEquals(i, arr.length);
      for (int j = 0; j < i; j++) {
        assertEquals(VALUES[j], arr[j]);
      }
    }
  }
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:16,代码来源:CharsTest.java

示例10: getAllowedPackageResourceTypes

import java.util.Collection; //导入方法依赖的package包/类
private Collection<QName> getAllowedPackageResourceTypes()
{
    // look for content nodes or links to content
    // NOTE: folders within workflow packages are ignored for now
    Collection<QName> allowedTypes = dictionaryService.getSubTypes(ContentModel.TYPE_CONTENT, true);
    allowedTypes.addAll(dictionaryService.getSubTypes(ApplicationModel.TYPE_FILELINK, true));
    return allowedTypes;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:JscriptWorkflowTask.java

示例11: onDisable

import java.util.Collection; //导入方法依赖的package包/类
@Override
public void onDisable() {
	pipeThread.setRunning(false);
	try {
		pipeThread.join();
	} catch (InterruptedException e) {
		e.printStackTrace();
	}
	savingManager.saveDuctsSync(true);

	// despawn all pipes and items
	Map<World, Map<BlockLoc, Duct>> fullDuctMap = getFullDuctMap();
	synchronized (fullDuctMap) {
		for (Map<BlockLoc, Duct> ductMap : fullDuctMap.values()) {
			for (Duct duct : ductMap.values()) {

				ductManager.destroyDuct(duct);

				if (duct instanceof Pipe) {
					Pipe pipe = (Pipe) duct;
					Collection<PipeItem> allItems = new ArrayList<>();
					synchronized (pipe.pipeItems) {
						allItems.addAll(pipe.pipeItems.keySet());
					}
					synchronized (pipe.tempPipeItems) {
						allItems.addAll(pipe.tempPipeItems.keySet());
					}
					synchronized (pipe.tempPipeItemsWithSpawn) {
						allItems.addAll(pipe.tempPipeItemsWithSpawn.keySet());
					}
					for (PipeItem pi : allItems) {
						ductManager.destroyPipeItem(pi);
					}
				}
			}
		}
	}

}
 
开发者ID:RoboTricker,项目名称:Transport-Pipes,代码行数:40,代码来源:TransportPipes.java

示例12: checkArgs

import java.util.Collection; //导入方法依赖的package包/类
/**
 * Extract values from command line entries and use as a means of configuration.
 *
 * @param line parsed command line
 * @return paths extracted from the command line
 */
private static Collection<Path> checkArgs(CommandLine line) {
	Collection<Path> validFiles = new LinkedList<>();
	
	for (String arg : checkFlags(line).getArgs()) {
		validFiles.addAll(checkPath(arg));
	}

	return validFiles;
}
 
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:16,代码来源:ConversionEntry.java

示例13: loadWhiteLists

import java.util.Collection; //导入方法依赖的package包/类
/**
 * Loads white lists of properties and group classes and add them to the given collections.
 */
private void loadWhiteLists(Resource[] resources, Collection<String> classes, Collection<String> names) throws IOException {
	for (Resource resource : resources) {
		Properties properties = new Properties();
		properties.load(resource.getInputStream());
		classes.addAll(Arrays.asList(StringUtils.delimitedListToStringArray(properties.getProperty(CONFIGURATION_PROPERTIES_CLASSES), ",", " ")));
		names.addAll(Arrays.asList(StringUtils.delimitedListToStringArray(properties.getProperty(CONFIGURATION_PROPERTIES_NAMES), ",", " ")));
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:12,代码来源:BootApplicationConfigurationMetadataResolver.java

示例14: addCompletions

import java.util.Collection; //导入方法依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
                              ProcessingContext context,
                              @NotNull CompletionResultSet result) {
    PsiElement position = parameters.getPosition().getOriginalElement();
    if (position == null) {
        return;
    }

    final Collection<PhpClassMember> members = new THashSet<>();
    String prefix = result.getPrefixMatcher().getPrefix();

    if (!(prefix.lastIndexOf("::") > 0 && prefix.lastIndexOf("\\") > 0
            && prefix.lastIndexOf("::") > prefix.lastIndexOf("\\"))) {
        return;
    }

    String className = prefix.substring(0, prefix.lastIndexOf("::"));

    PhpIndex phpIndex = PhpIndex.getInstance(parameters.getPosition().getProject());
    for (PhpClass phpClass : phpIndex.getAnyByFQN(className)) {
        members.addAll(phpClass.getFields());
        members.addAll(phpClass.getMethods());
    }

    for (PhpClassMember member : members) {
        if (Field.class.isInstance(member)) {
            result.addElement(
                    LookupElementBuilder
                            .create(className + (((Field) member).isConstant() ? "::" : "::$") + member.getName())
                            .withIcon(member.getIcon())
            );
        } else {
            result.addElement(
                    LookupElementBuilder
                            .create(className + "::" + member.getName() + "()")
                            .withIcon(member.getIcon())
            );
        }
    }
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:42,代码来源:PhpClassMemberCompletionProvider.java

示例15: create

import java.util.Collection; //导入方法依赖的package包/类
/**
 * Generic algorithm that takes an iterable over T objects, a getter routine to extract the reads in T,
 * and returns a FragmentCollection that contains the T objects whose underlying reads either overlap (or
 * not) with their mate pairs.
 *
 * @param readContainingObjects An iterator of objects that contain GATKSAMRecords
 * @param nElements the number of elements to be provided by the iterator, which is usually known upfront and
 *                  greatly improves the efficiency of the fragment calculation
 * @param getter a helper function that takes an object of type T and returns is associated GATKSAMRecord
 * @param <T>
 * @return a fragment collection
 */
private static <T> FragmentCollection<T> create(final Iterable<T> readContainingObjects, final int nElements, final ReadGetter<T> getter) {
    Collection<T> singletons = null;
    Collection<List<T>> overlapping = null;
    Map<String, T> nameMap = null;

    int lastStart = -1;

    // build an initial map, grabbing all of the multi-read fragments
    for ( final T p : readContainingObjects ) {
        final SAMRecord read = getter.get(p);

        if ( read.getAlignmentStart() < lastStart ) {
            throw new IllegalArgumentException(String.format(
                    "FragmentUtils.create assumes that the incoming objects are ordered by " +
                            "SAMRecord alignment start, but saw a read %s with alignment start " +
                            "%d before the previous start %d", read.getSAMString(), read.getAlignmentStart(), lastStart));
        }
        lastStart = read.getAlignmentStart();

        final int mateStart = read.getMateAlignmentStart();
        if ( mateStart == 0 || mateStart > read.getAlignmentEnd() ) {
            // if we know that this read won't overlap its mate, or doesn't have one, jump out early
            if ( singletons == null ) singletons = new ArrayList<T>(nElements); // lazy init
            singletons.add(p);
        } else {
            // the read might overlap it's mate, or is the rightmost read of a pair
            final String readName = read.getReadName();
            final T pe1 = nameMap == null ? null : nameMap.get(readName);
            if ( pe1 != null ) {
                // assumes we have at most 2 reads per fragment
                if ( overlapping == null ) overlapping = new ArrayList<List<T>>(); // lazy init
                overlapping.add(Arrays.asList(pe1, p));
                nameMap.remove(readName);
            } else {
                if ( nameMap == null ) nameMap = new HashMap<String, T>(nElements); // lazy init
                nameMap.put(readName, p);
            }
        }
    }

    // add all of the reads that are potentially overlapping but whose mate never showed
    // up to the oneReadPile
    if ( nameMap != null && ! nameMap.isEmpty() ) {
        if ( singletons == null )
            singletons = nameMap.values();
        else
            singletons.addAll(nameMap.values());
    }

    return new FragmentCollection<T>(singletons, overlapping);
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:64,代码来源:FragmentUtils.java


注:本文中的java.util.Collection.addAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。