本文整理匯總了Java中com.google.common.collect.SortedSetMultimap.put方法的典型用法代碼示例。如果您正苦於以下問題:Java SortedSetMultimap.put方法的具體用法?Java SortedSetMultimap.put怎麽用?Java SortedSetMultimap.put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.SortedSetMultimap
的用法示例。
在下文中一共展示了SortedSetMultimap.put方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: build
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
public ColumnFilter build()
{
boolean isFetchAll = metadata != null;
PartitionColumns queried = queriedBuilder == null ? null : queriedBuilder.build();
// It's only ok to have queried == null in ColumnFilter if isFetchAll. So deal with the case of a selectionBuilder
// with nothing selected (we can at least happen on some backward compatible queries - CASSANDRA-10471).
if (!isFetchAll && queried == null)
queried = PartitionColumns.NONE;
SortedSetMultimap<ColumnIdentifier, ColumnSubselection> s = null;
if (subSelections != null)
{
s = TreeMultimap.create(Comparator.<ColumnIdentifier>naturalOrder(), Comparator.<ColumnSubselection>naturalOrder());
for (ColumnSubselection subSelection : subSelections)
s.put(subSelection.column().name, subSelection);
}
return new ColumnFilter(isFetchAll, metadata, queried, s);
}
示例2: validateMethodAnnotations
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
/**
* Validates that a given class conforms to the following properties:
* <ul>
* <li>Only getters may be annotated with {@link JsonIgnore @JsonIgnore}.
* <li>If any getter is annotated with {@link JsonIgnore @JsonIgnore}, then all getters for
* this property must be annotated with {@link JsonIgnore @JsonIgnore}.
* </ul>
*
* @param allInterfaceMethods All interface methods that derive from {@link PipelineOptions}.
* @param descriptors The list of {@link PropertyDescriptor}s representing all valid bean
* properties of {@code iface}.
*/
private static void validateMethodAnnotations(
SortedSet<Method> allInterfaceMethods,
List<PropertyDescriptor> descriptors) {
SortedSetMultimap<Method, Method> methodNameToAllMethodMap =
TreeMultimap.create(MethodNameComparator.INSTANCE, MethodComparator.INSTANCE);
for (Method method : allInterfaceMethods) {
methodNameToAllMethodMap.put(method, method);
}
// Verify that there is no getter with a mixed @JsonIgnore annotation.
validateGettersHaveConsistentAnnotation(
methodNameToAllMethodMap, descriptors, AnnotationPredicates.JSON_IGNORE);
// Verify that there is no getter with a mixed @Default annotation.
validateGettersHaveConsistentAnnotation(
methodNameToAllMethodMap, descriptors, AnnotationPredicates.DEFAULT_VALUE);
// Verify that no setter has @JsonIgnore.
validateSettersDoNotHaveAnnotation(
methodNameToAllMethodMap, descriptors, AnnotationPredicates.JSON_IGNORE);
// Verify that no setter has @Default.
validateSettersDoNotHaveAnnotation(
methodNameToAllMethodMap, descriptors, AnnotationPredicates.DEFAULT_VALUE);
}
示例3: build
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
public ColumnFilter build()
{
boolean isFetchAll = metadata != null;
PartitionColumns selectedColumns = selection == null ? null : selection.build();
// It's only ok to have selection == null in ColumnFilter if isFetchAll. So deal with the case of a "selection" builder
// with nothing selected (we can at least happen on some backward compatible queries - CASSANDRA-10471).
if (!isFetchAll && selectedColumns == null)
selectedColumns = PartitionColumns.NONE;
SortedSetMultimap<ColumnIdentifier, ColumnSubselection> s = null;
if (subSelections != null)
{
s = TreeMultimap.create(Comparator.<ColumnIdentifier>naturalOrder(), Comparator.<ColumnSubselection>naturalOrder());
for (ColumnSubselection subSelection : subSelections)
s.put(subSelection.column().name, subSelection);
}
return new ColumnFilter(isFetchAll, metadata, selectedColumns, s);
}
示例4: getRecipesWithoutIngredient
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
public SortedSetMultimap<Integer, String> getRecipesWithoutIngredient(String ingredient) throws SQLException {
SortedSetMultimap<Integer, String> recipes = TreeMultimap.create(new InvertedComparator<Integer>(),
new InvertedComparator<String>());
PreparedStatement pStatement = connection.prepareStatement(
"SELECT gerichte2.name, COUNT(schmeckt.users_id) AS schmecktcount FROM gerichte AS gerichte2 " +
"LEFT JOIN schmeckt ON gerichte2.name = schmeckt.gerichte_name " +
"WHERE gerichte2.name NOT IN (" +
"SELECT gerichte.name FROM gerichte " +
"INNER JOIN versions ON gerichte.name = versions.gerichte_name AND gerichte.active_id = versions.id " +
"INNER JOIN versions_has_zutaten ON versions.gerichte_name = versions_gerichte_name AND id = versions_id " +
"WHERE zutaten_name = ?) " +
"GROUP BY gerichte2.name");
pStatement.setString(1, ingredient);
try (ResultSet data = pStatement.executeQuery()) {
while (data.next())
recipes.put(data.getInt("schmecktcount"), data.getString("gerichte2.name"));
}
return recipes;
}
示例5: deserialize
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
public ColumnFilter deserialize(DataInputPlus in, int version, CFMetaData metadata) throws IOException
{
int header = in.readUnsignedByte();
boolean isFetchAll = (header & IS_FETCH_ALL_MASK) != 0;
boolean hasQueried = (header & HAS_QUERIED_MASK) != 0;
boolean hasSubSelections = (header & HAS_SUB_SELECTIONS_MASK) != 0;
PartitionColumns queried = null;
if (hasQueried)
{
Columns statics = Columns.serializer.deserialize(in, metadata);
Columns regulars = Columns.serializer.deserialize(in, metadata);
queried = new PartitionColumns(statics, regulars);
}
SortedSetMultimap<ColumnIdentifier, ColumnSubselection> subSelections = null;
if (hasSubSelections)
{
subSelections = TreeMultimap.create(Comparator.<ColumnIdentifier>naturalOrder(), Comparator.<ColumnSubselection>naturalOrder());
int size = (int)in.readUnsignedVInt();
for (int i = 0; i < size; i++)
{
ColumnSubselection subSel = ColumnSubselection.serializer.deserialize(in, version, metadata);
subSelections.put(subSel.column().name, subSel);
}
}
return new ColumnFilter(isFetchAll, isFetchAll ? metadata : null, queried, subSelections);
}
示例6: getHistogram
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
/** Creates a histogram of the given collections */
static public <E extends Comparable<E>, T extends Comparable<T>> Multimap<T, E> getHistogram(Collection<E> elems,
Function<E, T> pivot) {
final SortedSetMultimap<T, E> histogram = TreeMultimap.create();
for (E elem : elems) {
T t = pivot.apply(elem);
histogram.put(t, elem);
}
return histogram;
}
示例7: setup
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
@Before
public void setup() {
final SortedSetMultimap<String, GenomeRegion> regionMap = TreeMultimap.create();
regionMap.put("X", GenomeRegionFactory.create("X", 100, 200));
regionMap.put("X", GenomeRegionFactory.create("X", 300, 400));
regionMap.put("Y", GenomeRegionFactory.create("Y", 500, 600));
bidirectionalSlicer = new BidirectionalSlicer(regionMap);
forwardSlicer = new ForwardSlicer(regionMap);
}
示例8: getRequiredGroupNamesToProperties
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
/**
* Returns a map of required groups of arguments to the properties that satisfy the requirement.
*/
private static SortedSetMultimap<String, String> getRequiredGroupNamesToProperties(
Map<String, Method> propertyNamesToGetters) {
SortedSetMultimap<String, String> result = TreeMultimap.create();
for (Map.Entry<String, Method> propertyEntry : propertyNamesToGetters.entrySet()) {
Required requiredAnnotation =
propertyEntry.getValue().getAnnotation(Validation.Required.class);
if (requiredAnnotation != null) {
for (String groupName : requiredAnnotation.groups()) {
result.put(groupName, propertyEntry.getKey());
}
}
}
return result;
}
示例9: validateReturnType
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
/**
* Validates that any method with the same name must have the same return type for all derived
* interfaces of {@link PipelineOptions}.
*
* @param iface The interface to validate.
*/
private static void validateReturnType(Class<? extends PipelineOptions> iface) {
Iterable<Method> interfaceMethods = FluentIterable
.from(ReflectHelpers.getClosureOfMethodsOnInterface(iface))
.filter(NOT_SYNTHETIC_PREDICATE)
.toSortedSet(MethodComparator.INSTANCE);
SortedSetMultimap<Method, Method> methodNameToMethodMap =
TreeMultimap.create(MethodNameComparator.INSTANCE, MethodComparator.INSTANCE);
for (Method method : interfaceMethods) {
methodNameToMethodMap.put(method, method);
}
List<MultipleDefinitions> multipleDefinitions = Lists.newArrayList();
for (Map.Entry<Method, Collection<Method>> entry
: methodNameToMethodMap.asMap().entrySet()) {
Set<Class<?>> returnTypes = FluentIterable.from(entry.getValue())
.transform(ReturnTypeFetchingFunction.INSTANCE).toSet();
SortedSet<Method> collidingMethods = FluentIterable.from(entry.getValue())
.toSortedSet(MethodComparator.INSTANCE);
if (returnTypes.size() > 1) {
MultipleDefinitions defs = new MultipleDefinitions();
defs.method = entry.getKey();
defs.collidingMethods = collidingMethods;
multipleDefinitions.add(defs);
}
}
throwForMultipleDefinitions(iface, multipleDefinitions);
}
示例10: buildCanonicalizedHeadersMap
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
private static Multimap<String, String> buildCanonicalizedHeadersMap(HttpMessage request) {
Header[] headers = request.getAllHeaders();
SortedSetMultimap<String, String> canonicalizedHeaders = TreeMultimap.create();
for (Header header : headers) {
if (header.getName() == null) {
continue;
}
String key = header.getName().toLowerCase();
canonicalizedHeaders.put(key, header.getValue());
}
return canonicalizedHeaders;
}
示例11: initializeAndUpgradeFromV1Offsets
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
public static SortedSetMultimap<TableContext, TableRuntimeContext> initializeAndUpgradeFromV1Offsets(
Map<String, TableContext> tableContextMap,
Map<String, String> offsets,
Set<String> offsetKeysToRemove
) throws StageException {
SortedSetMultimap<TableContext, TableRuntimeContext> returnMap = buildSortedPartitionMap();
for (Map.Entry<String, TableContext> tableEntry : tableContextMap.entrySet()) {
final String tableName = tableEntry.getKey();
final TableContext tableContext = tableEntry.getValue();
Map<String, String> startingOffsets;
String offsetValue = null;
Map<String, String> storedOffsets = null;
if (offsets.containsKey(tableName)) {
offsetValue = offsets.remove(tableName);
storedOffsets = OffsetQueryUtil.validateStoredAndSpecifiedOffset(tableContext, offsetValue);
offsetKeysToRemove.add(tableName);
startingOffsets = OffsetQueryUtil.getOffsetsFromSourceKeyRepresentation(offsetValue);
tableContext.getOffsetColumnToStartOffset().putAll(startingOffsets);
}
final TableRuntimeContext partition = createInitialPartition(tableContext, storedOffsets);
returnMap.put(tableContext, partition);
if (offsetValue != null) {
offsets.put(partition.getOffsetKey(), offsetValue);
}
}
return returnMap;
}
示例12: deserialize
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
public ColumnFilter deserialize(DataInputPlus in, int version, CFMetaData metadata) throws IOException
{
int header = in.readUnsignedByte();
boolean isFetchAll = (header & IS_FETCH_ALL_MASK) != 0;
boolean hasSelection = (header & HAS_SELECTION_MASK) != 0;
boolean hasSubSelections = (header & HAS_SUB_SELECTIONS_MASK) != 0;
PartitionColumns selection = null;
if (hasSelection)
{
Columns statics = Columns.serializer.deserialize(in, metadata);
Columns regulars = Columns.serializer.deserialize(in, metadata);
selection = new PartitionColumns(statics, regulars);
}
SortedSetMultimap<ColumnIdentifier, ColumnSubselection> subSelections = null;
if (hasSubSelections)
{
subSelections = TreeMultimap.create(Comparator.<ColumnIdentifier>naturalOrder(), Comparator.<ColumnSubselection>naturalOrder());
int size = (int)in.readUnsignedVInt();
for (int i = 0; i < size; i++)
{
ColumnSubselection subSel = ColumnSubselection.serializer.deserialize(in, version, metadata);
subSelections.put(subSel.column().name, subSel);
}
}
return new ColumnFilter(isFetchAll, isFetchAll ? metadata : null, selection, subSelections);
}
示例13: sortSymbols
import com.google.common.collect.SortedSetMultimap; //導入方法依賴的package包/類
@VisibleForTesting
static SortedSetMultimap<String, RDotTxtEntry> sortSymbols(
Map<Path, String> symbolsFileToRDotJavaPackage,
Optional<ImmutableMap<RDotTxtEntry, String>> uberRDotTxtIds,
ExecutionContext context) {
// If we're reenumerating, start at 0x7f01001 so that the resulting file is human readable.
// This value range (0x7f010001 - ...) is easier to spot as an actual resource id instead of
// other values in styleable which can be enumerated integers starting at 0.
Map<RDotTxtEntry, String> finalIds = null;
IntEnumerator enumerator = null;
if (uberRDotTxtIds.isPresent()) {
finalIds = uberRDotTxtIds.get();
} else {
enumerator = new IntEnumerator(0x7f01001);
}
SortedSetMultimap<String, RDotTxtEntry> rDotJavaPackageToSymbolsFiles = TreeMultimap.create();
for (Map.Entry<Path, String> entry : symbolsFileToRDotJavaPackage.entrySet()) {
Path symbolsFile = entry.getKey();
// Read the symbols file and parse each line as a Resource.
List<String> linesInSymbolsFile;
try {
linesInSymbolsFile =
FluentIterable.from(context.getProjectFilesystem().readLines(symbolsFile))
.filter(MoreStrings.NON_EMPTY)
.toList();
} catch (IOException e) {
throw new RuntimeException(e);
}
String packageName = entry.getValue();
for (String line : linesInSymbolsFile) {
Optional<RDotTxtEntry> parsedEntry = RDotTxtEntry.parse(line);
Preconditions.checkState(parsedEntry.isPresent(), "Should be able to match '%s'.", line);
// We're only doing the remapping so Roboelectric is happy and it is already ignoring the
// id references found in the styleable section. So let's do that as well so we don't have
// to get fancier than is needed. That is, just re-enumerate all app-level resource ids
// and ignore everything else, allowing the styleable references to be messed up.
RDotTxtEntry resource = parsedEntry.get();
if (uberRDotTxtIds.isPresent()) {
Preconditions.checkNotNull(finalIds);
if (!finalIds.containsKey(resource)) {
context.logError(
new RuntimeException(),
"Cannot find resource '%s' in the uber R.txt.", resource);
continue;
}
resource = resource.copyWithNewIdValue(finalIds.get(resource));
} else if (resource.idValue.startsWith("0x7f")) {
Preconditions.checkNotNull(enumerator);
resource = resource.copyWithNewIdValue(String.format("0x%08x", enumerator.next()));
}
rDotJavaPackageToSymbolsFiles.put(packageName, resource);
}
}
return rDotJavaPackageToSymbolsFiles;
}