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


Java Sets.newHashSet方法代码示例

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


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

示例1: getTextureLocations

import com.google.common.collect.Sets; //导入方法依赖的package包/类
protected Set<ResourceLocation> getTextureLocations(ModelBlock p_177585_1_)
{
    Set<ResourceLocation> set = Sets.<ResourceLocation>newHashSet();

    for (BlockPart blockpart : p_177585_1_.getElements())
    {
        for (BlockPartFace blockpartface : blockpart.mapFaces.values())
        {
            ResourceLocation resourcelocation = new ResourceLocation(p_177585_1_.resolveTextureName(blockpartface.texture));
            set.add(resourcelocation);
        }
    }

    set.add(new ResourceLocation(p_177585_1_.resolveTextureName("particle")));
    return set;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:ModelBakery.java

示例2: execute

import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
protected void execute() {
    RouterService service = get(RouterService.class);
    RouterId routerId = RouterId.valueOf(id);
    Router router = get(RouterService.class).getRouter(routerId);
    try {
        List<String> routes = new ArrayList<String>();
        Router routerObj = new DefaultRouter(
                                             RouterId.valueOf(id),
                                             routerName == null ? router.name() : routerName,
                                             adminStateUp,
                                             status == null ? Status.ACTIVE
                                                           : Status.valueOf(status),
                                             distributed,
                                             null,
                                             gatewayPortId == null ? router.gatewayPortid()
                                                                  : VirtualPortId.portId(gatewayPortId),
                                             tenantId == null ? router.tenantId()
                                                              : TenantId.tenantId(tenantId),
                                             routes);
        Set<Router> routerSet = Sets.newHashSet(routerObj);
        service.createRouters(routerSet);
    } catch (Exception e) {
        print(null, e.getMessage());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:RouterUpdateCommand.java

示例3: open

import com.google.common.collect.Sets; //导入方法依赖的package包/类
/**
 * Called to initialize this implementation.
 * @param spoutConfig used to pass in any configuration values.
 */
public void open(Map spoutConfig) {
    // Load config options.
    if (spoutConfig.containsKey(SpoutConfig.RETRY_MANAGER_RETRY_LIMIT)) {
        retryLimit = ((Number) spoutConfig.get(SpoutConfig.RETRY_MANAGER_RETRY_LIMIT)).intValue();
    }
    if (spoutConfig.containsKey(SpoutConfig.RETRY_MANAGER_INITIAL_DELAY_MS)) {
        initialRetryDelayMs = ((Number) spoutConfig.get(SpoutConfig.RETRY_MANAGER_INITIAL_DELAY_MS)).longValue();
    }
    if (spoutConfig.containsKey(SpoutConfig.RETRY_MANAGER_DELAY_MULTIPLIER)) {
        retryDelayMultiplier = ((Number) spoutConfig.get(SpoutConfig.RETRY_MANAGER_DELAY_MULTIPLIER)).doubleValue();
    }
    if (spoutConfig.containsKey(SpoutConfig.RETRY_MANAGER_MAX_DELAY_MS)) {
        retryDelayMaxMs = ((Number) spoutConfig.get(SpoutConfig.RETRY_MANAGER_MAX_DELAY_MS)).longValue();
    }

    // Init data structures.
    retriesInFlight = Sets.newHashSet();
    numberOfTimesFailed = Maps.newHashMap();
    failedMessageIds = Maps.newTreeMap();
}
 
开发者ID:salesforce,项目名称:storm-dynamic-spout,代码行数:25,代码来源:DefaultRetryManager.java

示例4: autoriseerAttributenViaGroepen

import com.google.common.collect.Sets; //导入方法依赖的package包/类
private void autoriseerAttributenViaGroepen(final Berichtgegevens berichtgegevens, final DienstbundelGroep dienstbundelGroep,
                                            final GroepElement groepElement, final Set<MetaGroep> metaGroepSet) {
    final boolean verantwoordingLeveren = berichtgegevens.getParameters().isVerantwoordingLeveren();
    for (final MetaGroep groep : metaGroepSet) {
        for (final MetaRecord metaRecord : groep.getRecords()) {
            if (!berichtgegevens.getKandidaatRecords().contains(metaRecord)) {
                continue;
            }
            final Set<String> teAutoriserenElementen = Sets.newHashSet();
            bepaalTeLeverenFormeleElementen(dienstbundelGroep, metaRecord, teAutoriserenElementen);
            bepaalTeLeverenMaterieleElementen(dienstbundelGroep, metaRecord, teAutoriserenElementen);
            bepaalTeLeverenVerantwoordingElementen(dienstbundelGroep, metaRecord, teAutoriserenElementen, verantwoordingLeveren);
            autoriseerAttribuut(berichtgegevens, groepElement, metaRecord, teAutoriserenElementen);
        }
    }
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:17,代码来源:AutoriseerHistorieEnVerantwoordingAttribuutServiceImpl.java

示例5: shouldFailIfNewPathIsNotUnderTreeWhenRename

import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Test
public void shouldFailIfNewPathIsNotUnderTreeWhenRename() throws IOException {
	createDir("client");
	addFileAndCommit("client/a.java", "a", "add a");
	addFileAndCommit("client/b.java", "b", "add b");
	
	createDir("server/src/com/example/a");
	createDir("server/src/com/example/b");
	addFileAndCommit("server/src/com/example/a/a.java", "a", "add a");
	addFileAndCommit("server/src/com/example/b/b.java", "b", "add b");
	
	String refName = "refs/heads/master";
	ObjectId oldCommitId = git.getRepository().resolve(refName);
	
	Map<String, BlobContent> newBlobs = new HashMap<>();
	newBlobs.put("client/a.java/a.java", new BlobContent.Immutable("a".getBytes(), FileMode.REGULAR_FILE));
	BlobEdits edits = new BlobEdits(Sets.newHashSet("server/src/com/example/a/a.java"), newBlobs);
	try {
		edits.commit(git.getRepository(), refName, oldCommitId, oldCommitId, user, "test rename tree");
		assertTrue("A NotTreeException should be thrown", false);
	} catch (NotTreeException e) {
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:24,代码来源:BlobEditsTest.java

示例6: generate

import com.google.common.collect.Sets; //导入方法依赖的package包/类
public Map<String, String> generate(Parser parser) throws Exception {
    Map<String, String> code = Maps.newHashMap();
    Set<String> schemaNames = Sets.newHashSet();
    this.dsl = parser.getAllParsedDSL();
    for (String name : parser.getSchemaNames()) {
        NamedSchema schema = (NamedSchema) parser.getSchema(name);
        if (schema.isRemoved()) {
            continue;
        }
        schemaNames.add(schema.getName());
        if (schema instanceof EnumSchema) {
            code.put(name, generateEnum((EnumSchema) schema));
        } else if (schema instanceof RecordSchema) {
            String className = SchemaNameUtils.classNameWithPackageFor(schema.getName());
            code.put(className, generateRecord((RecordSchema) schema));
        } else {
            throw new IllegalArgumentException("Unknown schema type " + schema);
        }
    }
    return code;
}
 
开发者ID:atlascon,项目名称:travny,代码行数:22,代码来源:Codegen.java

示例7: applyModifier

import com.google.common.collect.Sets; //导入方法依赖的package包/类
public void applyModifier(AttributeModifier modifier)
{
    if (this.getModifier(modifier.getID()) != null)
    {
        throw new IllegalArgumentException("Modifier is already applied on this attribute!");
    }
    else
    {
        Set<AttributeModifier> set = (Set)this.mapByName.get(modifier.getName());

        if (set == null)
        {
            set = Sets.<AttributeModifier>newHashSet();
            this.mapByName.put(modifier.getName(), set);
        }

        ((Set)this.mapByOperation.get(Integer.valueOf(modifier.getOperation()))).add(modifier);
        set.add(modifier);
        this.mapByUUID.put(modifier.getID(), modifier);
        this.flagForUpdate();
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:23,代码来源:ModifiableAttributeInstance.java

示例8: getItemsTextureLocations

import com.google.common.collect.Sets; //导入方法依赖的package包/类
private Set<ResourceLocation> getItemsTextureLocations()
{
    Set<ResourceLocation> set = Sets.<ResourceLocation>newHashSet();

    for (ResourceLocation resourcelocation : this.itemLocations.values())
    {
        ModelBlock modelblock = (ModelBlock)this.models.get(resourcelocation);

        if (modelblock != null)
        {
            set.add(new ResourceLocation(modelblock.resolveTextureName("particle")));

            if (this.hasItemModel(modelblock))
            {
                for (String s : ItemModelGenerator.LAYERS)
                {
                    set.add(new ResourceLocation(modelblock.resolveTextureName(s)));
                }
            }
            else if (!this.isCustomRenderer(modelblock))
            {
                for (BlockPart blockpart : modelblock.getElements())
                {
                    for (BlockPartFace blockpartface : blockpart.mapFaces.values())
                    {
                        ResourceLocation resourcelocation1 = new ResourceLocation(modelblock.resolveTextureName(blockpartface.texture));
                        set.add(resourcelocation1);
                    }
                }
            }
        }
    }

    return set;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:36,代码来源:ModelBakery.java

示例9: testPut

import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Test
public void testPut() throws Exception {
  channel.start();
  Assert.assertTrue(channel.isOpen());
  // should find no items
  int found = takeEvents(channel, 1, 5).size();
  Assert.assertEquals(0, found);
  Set<String> expected = Sets.newHashSet();
  expected.addAll(putEvents(channel, "unbatched", 1, 5));
  expected.addAll(putEvents(channel, "batched", 5, 5));
  Set<String> actual = takeEvents(channel, 1);
  compareInputAndOut(expected, actual);
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:14,代码来源:TestFileChannel.java

示例10: testGetArchiveIterator_04

import com.google.common.collect.Sets; //导入方法依赖的package包/类
@SuppressWarnings("javadoc")
@Test
public void testGetArchiveIterator_04() {
	Set<URI> containedURIs = Sets.newHashSet(getWorkspace().getArchiveIterator(
			archiveFileURI, "src/doesNotExist"));
	Set<URI> expectation = Sets.newHashSet();
	assertEquals(expectation, containedURIs);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:9,代码来源:AbstractInternalWorkspaceTest.java

示例11: getMultipartVariants

import com.google.common.collect.Sets; //导入方法依赖的package包/类
public Set<VariantList> getMultipartVariants()
{
    Set<VariantList> set = Sets.newHashSet(this.mapVariants.values());

    if (this.hasMultipartData())
    {
        set.addAll(this.multipart.getVariants());
    }

    return set;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:12,代码来源:ModelBlockDefinition.java

示例12: getDomainClasses

import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
protected Class<?>[] getDomainClasses()
{
	Set<Class<?>> clazzes = Sets.newHashSet();
	for( AbstractHibernateSchemaMigration migration : getMigrations() )
	{
		clazzes.addAll(Arrays.asList(migration.getDomainClasses()));
	}
	return clazzes.toArray(new Class<?>[clazzes.size()]);
}
 
开发者ID:equella,项目名称:Equella,代码行数:11,代码来源:AbstractCombinedSchemaMigration.java

示例13: destClasses

import com.google.common.collect.Sets; //导入方法依赖的package包/类
public Collection<ClassEntry> destClasses() {
	Set<ClassEntry> classes = Sets.newHashSet();
	for (ClassMatch match : matches()) {
		classes.addAll(match.destClasses);
	}
	return classes;
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:8,代码来源:ClassMatching.java

示例14: loadModels

import com.google.common.collect.Sets; //导入方法依赖的package包/类
private void loadModels()
{
    Deque<ResourceLocation> deque = Queues.<ResourceLocation>newArrayDeque();
    Set<ResourceLocation> set = Sets.<ResourceLocation>newHashSet();

    for (ResourceLocation resourcelocation : this.models.keySet())
    {
        set.add(resourcelocation);
        this.addModelParentLocation(deque, set, (ModelBlock)this.models.get(resourcelocation));
    }

    while (!((Deque)deque).isEmpty())
    {
        ResourceLocation resourcelocation1 = (ResourceLocation)deque.pop();

        try
        {
            if (this.models.get(resourcelocation1) != null)
            {
                continue;
            }

            ModelBlock modelblock = this.loadModel(resourcelocation1);
            this.models.put(resourcelocation1, modelblock);
            this.addModelParentLocation(deque, set, modelblock);
        }
        catch (Exception exception)
        {
            LOGGER.warn("In parent chain: {}; unable to load model: \'{}\'", new Object[] {JOINER.join(this.getParentPath(resourcelocation1)), resourcelocation1, exception});
        }

        set.add(resourcelocation1);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:35,代码来源:ModelBakery.java

示例15: register

import com.google.common.collect.Sets; //导入方法依赖的package包/类
public void register(Object target)
{
    if (listeners.containsKey(target))
    {
        return;
    }

    ModContainer activeModContainer = Loader.instance().activeModContainer();
    if (activeModContainer == null)
    {
        FMLLog.log(Level.ERROR, new Throwable(), "Unable to determine registrant mod for %s. This is a critical error and should be impossible", target);
        activeModContainer = Loader.instance().getMinecraftModContainer();
    }
    listenerOwners.put(target, activeModContainer);
    boolean isStatic = target.getClass() == Class.class;
    @SuppressWarnings("unchecked")
    Set<? extends Class<?>> supers = isStatic ? Sets.newHashSet((Class<?>)target) : TypeToken.of(target.getClass()).getTypes().rawTypes();
    for (Method method : (isStatic ? (Class<?>)target : target.getClass()).getMethods())
    {
        if (isStatic && !Modifier.isStatic(method.getModifiers()))
            continue;
        else if (!isStatic && Modifier.isStatic(method.getModifiers()))
            continue;

        for (Class<?> cls : supers)
        {
            try
            {
                Method real = cls.getDeclaredMethod(method.getName(), method.getParameterTypes());
                if (real.isAnnotationPresent(SubscribeEvent.class))
                {
                    Class<?>[] parameterTypes = method.getParameterTypes();
                    if (parameterTypes.length != 1)
                    {
                        throw new IllegalArgumentException(
                            "Method " + method + " has @SubscribeEvent annotation, but requires " + parameterTypes.length +
                            " arguments.  Event handler methods must require a single argument."
                        );
                    }

                    Class<?> eventType = parameterTypes[0];

                    if (!Event.class.isAssignableFrom(eventType))
                    {
                        throw new IllegalArgumentException("Method " + method + " has @SubscribeEvent annotation, but takes a argument that is not an Event " + eventType);
                    }

                    register(eventType, target, real, activeModContainer);
                    break;
                }
            }
            catch (NoSuchMethodException e)
            {
                ;
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:59,代码来源:EventBus.java


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