本文整理汇总了Java中com.google.common.collect.ImmutableSet.of方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableSet.of方法的具体用法?Java ImmutableSet.of怎么用?Java ImmutableSet.of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.ImmutableSet
的用法示例。
在下文中一共展示了ImmutableSet.of方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: next
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@Override public MethodParameter next() {
@Nonnull final String type = parameterTypes.next().toString();
@Nonnull final Set<? extends Annotation> annotations;
@Nullable final String name;
if (parameterAnnotations.hasNext()) {
annotations = parameterAnnotations.next();
} else {
annotations = ImmutableSet.of();
}
if (parameterNames.hasNext()) {
name = parameterNames.next();
} else {
name = null;
}
return new BaseMethodParameter() {
@Nonnull @Override public Set<? extends Annotation> getAnnotations() { return annotations; }
@Nullable @Override public String getName() { return name; }
@Nonnull @Override public String getType() { return type; }
};
}
示例2: BloomFilterCommonTester
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
private BloomFilterCommonTester(int hashId, int numInsertions) {
this.hashType = hashId;
this.numInsertions = numInsertions;
this.preAssertionHelper = new PreAssertionHelper() {
@Override
public ImmutableSet<Integer> falsePositives(int hashId) {
switch (hashId) {
case Hash.JENKINS_HASH: {
// // false pos for odd and event under 1000
return ImmutableSet.of(99, 963);
}
case Hash.MURMUR_HASH: {
// false pos for odd and event under 1000
return ImmutableSet.of(769, 772, 810, 874);
}
default: {
// fail fast with unknown hash error !!!
Assert.assertFalse("unknown hash error", true);
return ImmutableSet.of();
}
}
}
};
}
示例3: equality
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@Test
public void equality() {
Set<TestVertex> vertexes = ImmutableSet.of(A, B, C, D, E, F);
Set<TestVertex> vertexes2 = ImmutableSet.of(A, B, C, D, E, F, G);
AdjacencyListsGraph<TestVertex, TestEdge> graph = new AdjacencyListsGraph<>(vertexes, edges);
AdjacencyListsGraph<TestVertex, TestEdge> same = new AdjacencyListsGraph<>(vertexes, edges);
AdjacencyListsGraph<TestVertex, TestEdge> different = new AdjacencyListsGraph<>(vertexes2, edges);
new EqualsTester()
.addEqualityGroup(graph, same)
.addEqualityGroup(different)
.testEquals();
}
示例4: getPaths
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@Override
public Set<Path> getPaths(ElementId src, ElementId dst, LinkWeight weight) {
// If either edge is null, bail with no paths.
if (src == null || dst == null) {
return ImmutableSet.of();
}
// Otherwise get all paths between the source and destination edge
// devices.
computedPaths = topologyService.getPaths(null, (DeviceId) src, (DeviceId) dst, weight);
return computedPaths;
}
示例5: basics
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@Test
public void basics() {
Set<TestVertex> vertexes = ImmutableSet.of(A, B, C, D, E, F);
AdjacencyListsGraph<TestVertex, TestEdge> graph = new AdjacencyListsGraph<>(vertexes, edges);
assertEquals("incorrect vertex count", 6, graph.getVertexes().size());
assertEquals("incorrect edge count", 5, graph.getEdges().size());
assertEquals("incorrect egress edge count", 1, graph.getEdgesFrom(A).size());
assertEquals("incorrect ingress edge count", 1, graph.getEdgesTo(A).size());
assertEquals("incorrect ingress edge count", 1, graph.getEdgesTo(C).size());
assertEquals("incorrect egress edge count", 2, graph.getEdgesFrom(B).size());
assertEquals("incorrect ingress edge count", 2, graph.getEdgesTo(D).size());
}
示例6: HostToHostIntent
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
/**
* Creates a new host-to-host intent with the supplied host pair.
*
* @param appId application identifier
* @param key intent key
* @param one first host
* @param two second host
* @param selector action
* @param treatment ingress port
* @param constraints optional prioritized list of path selection constraints
* @param priority priority to use for flows generated by this intent
* @throws NullPointerException if {@code one} or {@code two} is null.
*/
private HostToHostIntent(ApplicationId appId, Key key,
HostId one, HostId two,
TrafficSelector selector,
TrafficTreatment treatment,
List<Constraint> constraints,
int priority) {
super(appId, key, ImmutableSet.of(one, two), selector, treatment,
constraints, priority);
// TODO: consider whether the case one and two are same is allowed
this.one = checkNotNull(one);
this.two = checkNotNull(two);
}
示例7: getDisjointPaths
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@Override
public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, LinkWeight weight) {
checkPermission(TOPOLOGY_READ);
checkNotNull(src, ELEMENT_ID_NULL);
checkNotNull(dst, ELEMENT_ID_NULL);
// Get the source and destination edge locations
EdgeLink srcEdge = getEdgeLink(src, true);
EdgeLink dstEdge = getEdgeLink(dst, false);
// If either edge is null, bail with no paths.
if (srcEdge == null || dstEdge == null) {
return ImmutableSet.of();
}
DeviceId srcDevice = srcEdge != NOT_HOST ? srcEdge.dst().deviceId() : (DeviceId) src;
DeviceId dstDevice = dstEdge != NOT_HOST ? dstEdge.src().deviceId() : (DeviceId) dst;
// If the source and destination are on the same edge device, there
// is just one path, so build it and return it.
if (srcDevice.equals(dstDevice)) {
return edgeToEdgePathsDisjoint(srcEdge, dstEdge);
}
// Otherwise get all paths between the source and destination edge
// devices.
Topology topology = topologyService.currentTopology();
Set<DisjointPath> paths = weight == null ?
topologyService.getDisjointPaths(topology, srcDevice, dstDevice) :
topologyService.getDisjointPaths(topology, srcDevice, dstDevice, weight);
return edgeToEdgePathsDisjoint(srcEdge, dstEdge, paths);
}
示例8: basics
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@Test
public void basics() {
DefaultGraphDescription desc =
new DefaultGraphDescription(4321L, System.currentTimeMillis(), ImmutableSet.of(DEV1, DEV2, DEV3),
ImmutableSet.of(L1, L2));
assertEquals("incorrect time", 4321L, desc.timestamp());
assertEquals("incorrect vertex count", 3, desc.vertexes().size());
assertEquals("incorrect edge count", 2, desc.edges().size());
}
示例9: testObsoleted
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
/**
* Test we're still prepared to drop views that we know nothing of.
*/
@Test
public void testObsoleted() {
ViewChanges c = new ViewChanges(
ImmutableSet.of(
view("A", "B"),
view("B", "C"),
view("C")
),
ImmutableSet.of(
view("B"),
view("X")
),
ImmutableSet.of(
view("A"),
view("B")
));
assertEquals("Views to drop mismatch", ImmutableSet.of("A", "B", "X"), nameSet(c.getViewsToDrop()));
assertEquals("Views to deploy mismatch", ImmutableSet.of("A", "B"), nameSet(c.getViewsToDeploy()));
Ordering<String> dropOrder = Ordering.explicit(nameList(c.getViewsToDrop()));
assertTrue("Must drop A before B", dropOrder.compare("A", "B") < 0);
Ordering<String> deployOrder = Ordering.explicit(nameList(c.getViewsToDeploy()));
assertTrue("Must deploy B before A", deployOrder.compare("B", "A") < 0);
}
示例10: createRequestHandlers
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@Override
protected Collection<RequestHandler> createRequestHandlers() {
return ImmutableSet.of(
new AlarmTableDataRequestHandler(),
new AlarmTableDetailRequestHandler()
);
}
示例11: supportedTypes
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@Override
public Iterable<ModelType<?>> supportedTypes() {
return ImmutableSet.of();
}
示例12: WatchPointsRegistry
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
public WatchPointsRegistry(boolean createNewStartingPointsUnderExistingRoots, FileSystem fileSystem) {
this.createNewStartingPointsUnderExistingRoots = createNewStartingPointsUnderExistingRoots;
this.fileSystem = fileSystem;
allRequestedRoots = ImmutableSet.of();
}
示例13: getDevices
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@Override
public Iterable<Device> getDevices() {
return ImmutableSet.of(device("a"), device("b"),
device("c"), device("d"),
device("e"), device("f"));
}
示例14: getDataTypes
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@Override
public Set<DataType> getDataTypes() {
return ImmutableSet.of(
SubsystemType.Instance
);
}
示例15: assertHasImmediateCancel
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
void assertHasImmediateCancel(
ListenableFuture<String> a, ListenableFuture<String> b, Exception e) {
ImmutableSet<ListenableFuture<String>> inputs = ImmutableSet.of(a, b);
smartAssertTrue(inputs, e,
intersect(inputs, ImmutableSet.of(doneCancelled)));
}