本文整理匯總了Java中com.google.common.collect.ImmutableSortedMap.copyOf方法的典型用法代碼示例。如果您正苦於以下問題:Java ImmutableSortedMap.copyOf方法的具體用法?Java ImmutableSortedMap.copyOf怎麽用?Java ImmutableSortedMap.copyOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.ImmutableSortedMap
的用法示例。
在下文中一共展示了ImmutableSortedMap.copyOf方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: DefaultStructBindings
import com.google.common.collect.ImmutableSortedMap; //導入方法依賴的package包/類
protected DefaultStructBindings(
StructSchema<T> publicSchema,
Iterable<? extends StructSchema<?>> declaredViewSchemas,
Iterable<? extends StructSchema<?>> implementedViewSchemas,
@Nullable StructSchema<?> delegateSchema,
Map<String, ManagedProperty<?>> managedProperties,
Iterable<StructMethodBinding> methodBindings
) {
this.publicSchema = publicSchema;
this.declaredViewSchemas = ImmutableSet.copyOf(declaredViewSchemas);
this.implementedViewSchemas = ImmutableSet.copyOf(implementedViewSchemas);
this.delegateSchema = delegateSchema;
this.managedProperties = ImmutableSortedMap.copyOf(managedProperties, Ordering.natural());
this.methodBindings = ImmutableList.copyOf(methodBindings);
}
示例2: ScoreKBPAgainstERE
import com.google.common.collect.ImmutableSortedMap; //導入方法依賴的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;
}
示例3: ThriftStructMetadata
import com.google.common.collect.ImmutableSortedMap; //導入方法依賴的package包/類
public ThriftStructMetadata(
String structName,
Map<String, String> idlAnnotations,
Type structType,
Type builderType,
MetadataType metadataType,
Optional<ThriftMethodInjection> builderMethod,
List<String> documentation,
List<ThriftFieldMetadata> fields,
Optional<ThriftConstructorInjection> constructorInjection,
List<ThriftMethodInjection> methodInjections)
{
this.builderType = builderType;
this.builderMethod = requireNonNull(builderMethod, "builderMethod is null");
this.structName = requireNonNull(structName, "structName is null");
this.idlAnnotations = requireNonNull(idlAnnotations, "idlAnnotations is null");
this.metadataType = requireNonNull(metadataType, "metadataType is null");
this.structType = requireNonNull(structType, "structType is null");
this.constructorInjection = requireNonNull(constructorInjection, "constructorInjection is null");
this.documentation = ImmutableList.copyOf(requireNonNull(documentation, "documentation is null"));
this.fields = ImmutableSortedMap.copyOf(uniqueIndex(requireNonNull(fields, "fields is null"), ThriftFieldMetadata::getId));
this.methodInjections = ImmutableList.copyOf(requireNonNull(methodInjections, "methodInjections is null"));
}
示例4: Settings
import com.google.common.collect.ImmutableSortedMap; //導入方法依賴的package包/類
Settings(Map<String, String> settings) {
// we use a sorted map for consistent serialization when using getAsMap()
// TODO: use Collections.unmodifiableMap with a TreeMap
this.settings = ImmutableSortedMap.copyOf(settings);
Map<String, String> forcedUnderscoreSettings = null;
for (Map.Entry<String, String> entry : settings.entrySet()) {
String toUnderscoreCase = Strings.toUnderscoreCase(entry.getKey());
if (!toUnderscoreCase.equals(entry.getKey())) {
if (forcedUnderscoreSettings == null) {
forcedUnderscoreSettings = new HashMap<>();
}
forcedUnderscoreSettings.put(toUnderscoreCase, entry.getValue());
}
}
this.forcedUnderscoreSettings = forcedUnderscoreSettings == null ? ImmutableMap.<String, String>of() : ImmutableMap.copyOf(forcedUnderscoreSettings);
}
示例5: BlockStateContainer
import com.google.common.collect.ImmutableSortedMap; //導入方法依賴的package包/類
protected BlockStateContainer(Block blockIn, IProperty<?>[] properties, ImmutableMap<net.minecraftforge.common.property.IUnlistedProperty<?>, com.google.common.base.Optional<?>> unlistedProperties)
{
this.block = blockIn;
Map < String, IProperty<? >> map = Maps. < String, IProperty<? >> newHashMap();
for (IProperty<?> iproperty : properties)
{
validateProperty(blockIn, iproperty);
map.put(iproperty.getName(), iproperty);
}
this.properties = ImmutableSortedMap. < String, IProperty<? >> copyOf(map);
Map < Map < IProperty<?>, Comparable<? >> , BlockStateContainer.StateImplementation > map2 = Maps. < Map < IProperty<?>, Comparable<? >> , BlockStateContainer.StateImplementation > newLinkedHashMap();
List<BlockStateContainer.StateImplementation> list1 = Lists.<BlockStateContainer.StateImplementation>newArrayList();
for (List < Comparable<? >> list : Cartesian.cartesianProduct(this.getAllowedValues()))
{
Map < IProperty<?>, Comparable<? >> map1 = MapPopulator. < IProperty<?>, Comparable<? >> createMap(this.properties.values(), list);
BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map1), unlistedProperties);
map2.put(map1, blockstatecontainer$stateimplementation);
list1.add(blockstatecontainer$stateimplementation);
}
for (BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation1 : list1)
{
blockstatecontainer$stateimplementation1.buildPropertyValueTable(map2);
}
this.validStates = ImmutableList.<IBlockState>copyOf(list1);
}
示例6: HealthChecker
import com.google.common.collect.ImmutableSortedMap; //導入方法依賴的package包/類
@Inject
HealthChecker(
UriInfo uriInfo,
ServiceMetadata serviceMetadata,
Map<String, HealthDependency> healthDependencies) {
this.uriInfo = uriInfo;
this.serviceMetadata = serviceMetadata;
this.healthDependencies = ImmutableSortedMap.copyOf(healthDependencies);
}
示例7: testConstructTermAnnotationToLabelsMap
import com.google.common.collect.ImmutableSortedMap; //導入方法依賴的package包/類
@Test
public void testConstructTermAnnotationToLabelsMap() {
Map<TermId, Collection<String>> map = ImmutableSortedMap
.copyOf(TermAnnotations.constructTermAnnotationToLabelsMap(ontology, annotations));
assertEquals(
"{ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001]=[two, one], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000002]=[two, three, one], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000003]=[two, one], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000004]=[two, one], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005]=[two, three, one]}",
map.toString());
}
示例8: testConstructTermLabelToAnnotationsMap
import com.google.common.collect.ImmutableSortedMap; //導入方法依賴的package包/類
@Test
public void testConstructTermLabelToAnnotationsMap() {
Map<String, Collection<TermId>> map = ImmutableSortedMap
.copyOf(TermAnnotations.constructTermLabelToAnnotationsMap(ontology, annotations));
assertEquals(
"{one=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000002], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000003], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000004], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001]], three=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000002], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005]], two=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000002], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000003], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000004], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001]]}",
map.toString());
}
示例9: makeSkinny
import com.google.common.collect.ImmutableSortedMap; //導入方法依賴的package包/類
/**
* Utility method used to convert static {@link Map}'s concrete type to a {@link ImmutableSortedMap}.
* {@link ImmutableSortedMap} have a 8 byte overhead per element and are useful for reducing the per element
* overhead, that is traditionally high on most {@code Map} implementations.
*
* @return A {@link ImmutableSortedMap} created from a {@link Map} of {@link NounForm}'s (key) to {@link String}'s
* (value).
*/
public <T extends NounForm> Map<T, String> makeSkinny(Map<T, String> map) {
return ImmutableSortedMap.copyOf(map, new Comparator<NounForm>() {
@Override
public int compare(NounForm n1, NounForm n2) {
return n1.getKey().compareTo(n2.getKey());
}
});
}
示例10: SkinnyMapPropertyFileData
import com.google.common.collect.ImmutableSortedMap; //導入方法依賴的package包/類
/**
* Creates a new {@link SkinnyMapPropertyFileData} from existing MapPropertyFileData
*
* @param m MapPropertyFileData that will be copied into a ImmutableSortedMap.
*/
public SkinnyMapPropertyFileData(MapPropertyFileData m) {
this.locale = m.locale;
this.publicSections = ImmutableSet.copyOf(m.getPublicSectionNames());
for (Entry<String, Map<String, Object>> e : m.entrySet()) {
// Convert the parameter HashMap's to ImmutableSortedMap's to reduce memory required.
m.data.put(e.getKey(), ImmutableSortedMap.copyOf(e.getValue()));
}
// Convert the section HashMap to ImmutableSortedMap
data = ImmutableSortedMap.copyOf(m.data);
}
示例11: BlockStateContainer
import com.google.common.collect.ImmutableSortedMap; //導入方法依賴的package包/類
protected BlockStateContainer(Block p_i9_1_, IProperty<?>[] p_i9_2_, ImmutableMap < IUnlistedProperty<?>, Optional<? >> p_i9_3_)
{
this.block = p_i9_1_;
Map < String, IProperty<? >> map = Maps. < String, IProperty<? >> newHashMap();
for (IProperty<?> iproperty : p_i9_2_)
{
validateProperty(p_i9_1_, iproperty);
map.put(iproperty.getName(), iproperty);
}
this.properties = ImmutableSortedMap. < String, IProperty<? >> copyOf(map);
Map < Map < IProperty<?>, Comparable<? >> , BlockStateContainer.StateImplementation > map2 = Maps. < Map < IProperty<?>, Comparable<? >> , BlockStateContainer.StateImplementation > newLinkedHashMap();
List<BlockStateContainer.StateImplementation> list = Lists.<BlockStateContainer.StateImplementation>newArrayList();
for (List < Comparable<? >> list1 : Cartesian.cartesianProduct(this.getAllowedValues()))
{
Map < IProperty<?>, Comparable<? >> map1 = MapPopulator. < IProperty<?>, Comparable<? >> createMap(this.properties.values(), list1);
BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation = this.createState(p_i9_1_, ImmutableMap. < IProperty<?>, Comparable<? >> copyOf(map1), p_i9_3_);
map2.put(map1, blockstatecontainer$stateimplementation);
list.add(blockstatecontainer$stateimplementation);
}
for (BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation1 : list)
{
blockstatecontainer$stateimplementation1.buildPropertyValueTable(map2);
}
this.validStates = ImmutableList.copyOf(list);
}
示例12: toString
import com.google.common.collect.ImmutableSortedMap; //導入方法依賴的package包/類
@Override
public String toString() {
return "ImmutableDirectedGraph [edgeLists=" + ImmutableSortedMap.copyOf(edgeLists)
+ ", edgeCount=" + edgeCount + "]";
}
示例13: load
import com.google.common.collect.ImmutableSortedMap; //導入方法依賴的package包/類
/**
* @param factory The {@link OboOntologyEntryFactory} for constructing concrete terms and term
* relations.
* @return Freshly loaded and constructed {@link ImmutableOntology}.
* @throws IOException In the case of problems with I/O.
*/
public ImmutableOntology<T, R> load(OboOntologyEntryFactory<T, R> factory) throws IOException {
// Construct helper, set the term Id mapping into factory, and trigger parsing.
final HelperListener helper = new HelperListener(factory);
factory.setTermIds(helper.getTermIds());
parser.parseFile(file, helper);
if (helper.getAllTermIds().size() == 0) {
throw new OntoLibRuntimeException("No terms in ontology?!");
}
/*
* Note on the effect of event-based parsing.
*
* If the implementation is correct, we now have a relatively compact (depending on the
* implementation of factory, of course) representation of the ontology in memory using the
* objects from <code>ontolib-core</code> only. All objects that have the full representation of
* the ontology (from <code>ontolib-io</code>) can be freed by GC after this point.
*
* The only exception are the Stanza objects that we have to store for the candidate roots.
*/
// Get term Id (of possibly artificial) root.
final ImmutableTermId rootTermId = findOrCreateArtificalRoot(helper, factory);
// Construct edge list and relation map.
final List<ImmutableEdge<TermId>> edges = new ArrayList<>();
final Map<Integer, R> relationMap = new HashMap<>();
for (Entry<ImmutableTermId, List<BundledIsARelation>> e : helper.getIsATermIdPairs()
.entrySet()) {
for (BundledIsARelation b : e.getValue()) {
edges.add(ImmutableEdge.construct(e.getKey(), b.getDest(), b.getRelation().getId()));
relationMap.put(b.getRelation().getId(), b.getRelation());
}
}
ImmutableDirectedGraph<TermId, ImmutableEdge<TermId>> graph =
ImmutableDirectedGraph.construct(helper.getAllTermIds(), edges, true);
return new ImmutableOntology<T, R>(ImmutableSortedMap.copyOf(helper.getMetaInfo()), graph,
rootTermId, helper.getTerms().keySet(), helper.getObsoleteTerms().keySet(),
ImmutableMap.copyOf(helper.getTerms()), ImmutableMap.copyOf(relationMap));
}
示例14: create
import com.google.common.collect.ImmutableSortedMap; //導入方法依賴的package包/類
@Override
public SortedMap<String, String> create(Entry<String, String>[] entries) {
return ImmutableSortedMap.copyOf(Arrays.asList(entries));
}
示例15: sortByValue
import com.google.common.collect.ImmutableSortedMap; //導入方法依賴的package包/類
public static <K, V extends Comparable<? super V>> Map<K, V> sortByValue(Map<K, V> map) {
return ImmutableSortedMap.copyOf(map, Ordering.natural().onResultOf(Functions.forMap(map)).reverse());
}