本文整理汇总了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;
}
示例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());
}
}
示例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();
}
示例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) {
}
}
示例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;
}
示例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();
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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()]);
}
示例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;
}
示例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);
}
}
示例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)
{
;
}
}
}
}