本文整理汇总了Java中com.google.common.collect.ImmutableMap.copyOf方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableMap.copyOf方法的具体用法?Java ImmutableMap.copyOf怎么用?Java ImmutableMap.copyOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.ImmutableMap
的用法示例。
在下文中一共展示了ImmutableMap.copyOf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ScoreKBPAgainstERE
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
@Inject
ScoreKBPAgainstERE(
final Parameters params,
final Map<String, ScoringEventObserver<DocLevelEventArg, DocLevelEventArg>> scoringEventObservers,
final ResponsesAndLinkingFromEREExtractor responsesAndLinkingFromEREExtractor,
ResponsesAndLinkingFromKBPExtractorFactory responsesAndLinkingFromKBPExtractorFactory,
@DocIDsToScoreP Set<Symbol> docIdsToScore,
@KeyFileMapP Map<Symbol, File> keyFilesMap,
Predicate<DocLevelEventArg> inScopePredicate,
@PermitMissingSystemDocsP boolean permitMissingSystemDocuments) {
this.params = checkNotNull(params);
// we use a sorted map because the binding of plugins may be non-deterministic
this.scoringEventObservers = ImmutableSortedMap.copyOf(scoringEventObservers);
this.responsesAndLinkingFromEREExtractor = checkNotNull(responsesAndLinkingFromEREExtractor);
this.responsesAndLinkingFromKBPExtractorFactory = responsesAndLinkingFromKBPExtractorFactory;
this.docIDsToScore = ImmutableSet.copyOf(docIdsToScore);
this.goldDocIDToFileMap = ImmutableMap.copyOf(keyFilesMap);
this.inScopePredicate = inScopePredicate;
this.permitMissingSystemDocuments = permitMissingSystemDocuments;
}
示例2: getClassPathEntries
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
@VisibleForTesting
static ImmutableMap<File, ClassLoader> getClassPathEntries(ClassLoader classloader) {
LinkedHashMap<File, ClassLoader> entries = Maps.newLinkedHashMap();
// Search parent first, since it's the order ClassLoader#loadClass() uses.
ClassLoader parent = classloader.getParent();
if (parent != null) {
entries.putAll(getClassPathEntries(parent));
}
if (classloader instanceof URLClassLoader) {
URLClassLoader urlClassLoader = (URLClassLoader) classloader;
for (URL entry : urlClassLoader.getURLs()) {
if (entry.getProtocol().equals("file")) {
File file = toFile(entry);
if (!entries.containsKey(file)) {
entries.put(file, classloader);
}
}
}
}
return ImmutableMap.copyOf(entries);
}
示例3: MethodMetadata
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
public MethodMetadata(
String name,
List<ParameterMetadata> parameters,
ThriftCodec<Object> resultCodec,
Map<Short, ThriftCodec<Object>> exceptionCodecs,
boolean oneway)
{
this.name = requireNonNull(name, "name is null");
this.parameters = ImmutableList.copyOf(requireNonNull(parameters, "parameters is null"));
this.resultCodec = requireNonNull(resultCodec, "resultCodec is null");
this.exceptionCodecs = ImmutableMap.copyOf(requireNonNull(exceptionCodecs, "exceptionCodecs is null"));
this.oneway = oneway;
}
示例4: create
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
@Override
protected Map<AnEnum, String> create(Entry<AnEnum, String>[] entries) {
EnumMap<AnEnum, String> map = new EnumMap<AnEnum, String>(AnEnum.class);
for (Entry<AnEnum, String> entry : entries) {
map.put(entry.getKey(), entry.getValue());
}
return ImmutableMap.copyOf(map);
}
示例5: GenericValue
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
private GenericValue(Builder<T> builder) {
this.quantities = ImmutableMap.copyOf(builder.quantities);
int totalQuantity = 0;
for (Integer quantity : quantities.values()) {
totalQuantity += quantity;
}
this.totalQuantity = totalQuantity;
this.value = builder.value;
this.size = calcSize();
}
示例6: asMap
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
@Nonnull
@Override
public ImmutableMap<MetadataKey<?>, Object> asMap() {
lock.lock();
try {
return ImmutableMap.copyOf(map);
} finally {
lock.unlock();
}
}
示例7: populate
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
private void populate(List<PlanFragment> fragments){
Map<NodeEndpoint, NodeTracker> trackers = new HashMap<>();
Map<FragmentHandle, FragmentData> dataCollectors = new HashMap<>();
ArrayListMultimap<Integer, FragmentData> majors = ArrayListMultimap.create();
for(PlanFragment fragment : fragments) {
final NodeEndpoint assignment = fragment.getAssignment();
NodeTracker tracker = trackers.get(assignment);
if (tracker == null) {
tracker = new NodeTracker(assignment);
trackers.put(assignment, tracker);
}
tracker.addFragment();
FragmentData data = new FragmentData(fragment.getHandle(), assignment);
dataCollectors.put(fragment.getHandle(), data);
majors.put(fragment.getHandle().getMajorFragmentId(), data);
}
// Major fragments are required to be dense: numbered 0 through N-1
MajorFragmentReporter[] tempReporters = new MajorFragmentReporter[majors.asMap().size()];
for(Map.Entry<Integer, Collection<FragmentData>> e : majors.asMap().entrySet()) {
Preconditions.checkElementIndex(e.getKey(), majors.asMap().size());
Preconditions.checkState(tempReporters[e.getKey()] == null);
tempReporters[e.getKey()] = new MajorFragmentReporter(e.getKey(), e.getValue());
}
this.reporters = ImmutableList.copyOf(tempReporters);
this.nodeMap = ImmutableMap.copyOf(trackers);
this.fragmentDataMap = ImmutableMap.copyOf(dataCollectors);
}
示例8: getAllSwitchMap
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
public Map<DatapathId, IOFSwitch> getAllSwitchMap(boolean showInvisible) {
if(showInvisible) {
return ImmutableMap.<DatapathId, IOFSwitch>copyOf(switches);
} else {
ImmutableMap.Builder<DatapathId, IOFSwitch> builder = ImmutableMap.builder();
for(IOFSwitch sw: switches.values()) {
if(sw.getStatus().isVisible())
builder.put(sw.getId(), sw);
}
return builder.build();
}
}
示例9: BlockState
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
public BlockState(Block blockIn, IProperty... properties)
{
this.block = blockIn;
Arrays.sort(properties, new Comparator<IProperty>()
{
public int compare(IProperty p_compare_1_, IProperty p_compare_2_)
{
return p_compare_1_.getName().compareTo(p_compare_2_.getName());
}
});
this.properties = ImmutableList.copyOf(properties);
Map<Map<IProperty, Comparable>, BlockState.StateImplementation> map = Maps.<Map<IProperty, Comparable>, BlockState.StateImplementation>newLinkedHashMap();
List<BlockState.StateImplementation> list = Lists.<BlockState.StateImplementation>newArrayList();
for (List<Comparable> list1 : Cartesian.cartesianProduct(this.getAllowedValues()))
{
Map<IProperty, Comparable> map1 = MapPopulator.<IProperty, Comparable>createMap(this.properties, list1);
BlockState.StateImplementation blockstate$stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map1));
map.put(map1, blockstate$stateimplementation);
list.add(blockstate$stateimplementation);
}
for (BlockState.StateImplementation blockstate$stateimplementation1 : list)
{
blockstate$stateimplementation1.buildPropertyValueTable(map);
}
this.validStates = ImmutableList.<IBlockState>copyOf(list);
}
示例10: getIndexedModList
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
public Map<String,ModContainer> getIndexedModList()
{
return ImmutableMap.copyOf(namedMods);
}
示例11: State
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
public State(String name, Map<String, String> properties) {
this.name = checkNotNull(name, "name == null!");
this.properties = ImmutableMap.copyOf(properties);
}
示例12: getConfiguration
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
@Override
public Map<String, String> getConfiguration() {
return ImmutableMap.copyOf(configuration);
}
示例13: DefaultEclipseBuildCommand
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
public DefaultEclipseBuildCommand(String name, Map<String, String> arguments) {
this.name = name;
this.arguments = ImmutableMap.copyOf(arguments);
}
示例14: addPrefixConfig
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
private void addPrefixConfig(final PrefixShardConfiguration config) {
final Map<DOMDataTreeIdentifier, PrefixShardConfiguration> newPrefixConfigMap = new HashMap<>(prefixConfigMap);
newPrefixConfigMap.put(config.getPrefix(), config);
prefixConfigMap = ImmutableMap.copyOf(newPrefixConfigMap);
}
示例15: snapshot
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
public CompilationState snapshot() {
return new CompilationState(ImmutableSet.copyOf(sourceInputs), ImmutableMap.copyOf(fileStates));
}