本文整理汇总了Java中com.google.common.collect.LinkedListMultimap类的典型用法代码示例。如果您正苦于以下问题:Java LinkedListMultimap类的具体用法?Java LinkedListMultimap怎么用?Java LinkedListMultimap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LinkedListMultimap类属于com.google.common.collect包,在下文中一共展示了LinkedListMultimap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findClashingMembersByName
import com.google.common.collect.LinkedListMultimap; //导入依赖的package包/类
/**
* Find clashes by name.
*
* @param myPolyMember
* current validated Polyfill
* @param pivotPolyMember
* other polyfill in same project
* @return pairs of contrandicting or same polyfills.
*/
private ListMultimap<TMember, TMember> findClashingMembersByName(EList<TMember> myPolyMember,
EList<TMember> pivotPolyMember) {
ListMultimap<TMember, TMember> ret = LinkedListMultimap.create();
for (TMember my : myPolyMember) {
String myName = my.getName();
if (myName == null)
continue; // broken AST
for (TMember other : pivotPolyMember) {
String otherName = other.getName();
if (myName.equals(otherName)) {
ret.put(my, other);
}
}
}
return ret;
}
示例2: getFeedMetaDataValueAt
import com.google.common.collect.LinkedListMultimap; //导入依赖的package包/类
public static String getFeedMetaDataValueAt(final Context context, final int value,
final int position) {
final LinkedListMultimap<String, String> map = getFeedMetaData(context);
int i = 0;
for (final String title : map.asMap().keySet()) {
if (i == position) {
if (value == CATEGORY) {
return map.get(title).get(CATEGORY);
} else if (value == FEED_URL) {
return map.get(title).get(FEED_URL);
}
return map.get(title).get(FEED_ID);
}
i++;
}
return null;
}
示例3: getFeedMetaDataTitlesAt
import com.google.common.collect.LinkedListMultimap; //导入依赖的package包/类
public static List<String> getFeedMetaDataTitlesAt(final Context context,
final List<Integer> positions) {
final LinkedListMultimap<String, String> map = getFeedMetaData(context);
final List<String> titles = new ArrayList<>();
int i = 0;
for (final String title : map.asMap().keySet()) {
if (positions.contains(i)) {
titles.add(title);
}
i++;
}
return titles;
}
示例4: getSearchResultsFor
import com.google.common.collect.LinkedListMultimap; //导入依赖的package包/类
public static SearchResultsCursor getSearchResultsFor(final Context context,
final String query) {
final LinkedListMultimap<String, String> map = getFeedMetaData(context);
final List<Integer> positions = new ArrayList<>();
final List<LinkedHashMap<Integer, Integer>> indices = new ArrayList<>();
int i = 0;
for (final String title : map.asMap().keySet()) {
if (org.apache.commons.lang3.StringUtils.containsIgnoreCase(title, query)) {
indices.add(SearchUtils.getIndicesForQuery(title, query));
positions.add(i);
}
i++;
}
return new SearchResultsCursor(positions, indices);
}
示例5: updateFeedMetaDataUrl
import com.google.common.collect.LinkedListMultimap; //导入依赖的package包/类
@SuppressWarnings("ResultOfMethodCallIgnored")
public static void updateFeedMetaDataUrl(final Context context, final String feedUrl) {
final LinkedListMultimap<String, String> map = getFeedMetaData(context);
final int position = getCurrentFeedAdapterPosition(context);
int i = 0;
for (final String title : map.asMap().keySet()) {
if (i == position) {
final List<String> values = new ArrayList<>(map.get(title));
values.set(FEED_URL, feedUrl);
map.replaceValues(title, values);
putFeedMetaData(context, map);
break;
}
i++;
}
}
示例6: updateFeedMetaDataAt
import com.google.common.collect.LinkedListMultimap; //导入依赖的package包/类
@SuppressWarnings({"ResultOfMethodCallIgnored", "ConstantConditions"})
public static void updateFeedMetaDataAt(final Context context, final int position,
final List<String> metaData) {
final LinkedListMultimap<String, String> map = getFeedMetaData(context);
final String currentTitle = getFeedMetaDataTitleAt(context, position);
final String newTitle = metaData.get(TITLE);
final String category = metaData.get(FEED_ID);
final List<String> values = new ArrayList<>(map.removeAll(currentTitle));
values.set(CATEGORY, category);
map.putAll(newTitle, values);
putFeedMetaData(context, map);
updateCurrentFeedAdapterPosition(context, newTitle);
}
示例7: groupingByValues
import com.google.common.collect.LinkedListMultimap; //导入依赖的package包/类
public static <T, L, K> Collector<T, ?, ImmutableMultimap<K, T>> groupingByValues(Function<? super T, ? extends Iterable<? extends K>> classifier) {
return ImmutableGenericCollector.<T, LinkedListMultimap<K, T>, ImmutableMultimap<K, T>>builder()
.supplier(LinkedListMultimap::create)
.accumulator((map, t) -> {
classifier.apply(t).forEach(k -> {
map.put(k, t);
});
})
.combiner((a,b) -> {
LinkedListMultimap<K, T> ret = LinkedListMultimap.create(a);
ret.putAll(b);
return ret;
})
.finisher(map -> ImmutableMultimap.copyOf(map))
.build();
}
示例8: readReverse
import com.google.common.collect.LinkedListMultimap; //导入依赖的package包/类
private ListMultimap<String, Thing> readReverse(JsonReader reader) throws IOException {
reader.beginObject();
ListMultimap<String, Thing> reverseMap = LinkedListMultimap.create();
while (reader.hasNext()) {
String property = reader.nextName();
JsonToken token = reader.peek();
if (token == JsonToken.BEGIN_OBJECT) {
reverseMap.put(property, readObject(reader));
} else if (token == JsonToken.BEGIN_ARRAY) {
reader.beginArray();
while (reader.hasNext()) {
reverseMap.put(property, readObject(reader));
}
reader.endArray();
} else {
throw new JsonLdSyntaxException(
String.format(
"Invalid value token %s in @reverse. Should be a JSON-LD object or an "
+ "array of JSON-LD objects",
token));
}
}
reader.endObject();
return reverseMap;
}
示例9: getXPath
import com.google.common.collect.LinkedListMultimap; //导入依赖的package包/类
static String getXPath(LinkedListMultimap<LinkedListMultimap<XPathElement, LinkedList<ACTIONS>>, LinkedListMultimap<ATTRIBUTES, XPathValues>> xpathListMap) {
String xpath = "";
for (Map.Entry<LinkedListMultimap<XPathElement, LinkedList<ACTIONS>>, LinkedListMultimap<ATTRIBUTES, XPathValues>> mapEntry : xpathListMap.entries()) {
for (Map.Entry<XPathElement, LinkedList<ACTIONS>> elementActionsMapEntry : mapEntry.getKey().entries()) {
for (Map.Entry<PREFIX, ELEMENTS> elementEntry : elementActionsMapEntry.getKey().entries()) {
/** Adding into Xpath '// + element' or '/ + element' */
xpath = xpath + XPathBuilder.getElementXpath(elementEntry.getKey(), elementEntry.getValue());
/** Adding into Xpath '// + element' or '/ + element' */
for (ACTIONS action : elementActionsMapEntry.getValue()) {
for (Map.Entry<ATTRIBUTES, XPathValues> attributesValuesMapEntry : mapEntry.getValue().entries()) {
/** Adding into Xpath based on action [contains|equals etc...] an [@attribute='value'] */
xpath = xpath + XPathBuilder.getXPath(action, attributesValuesMapEntry.getKey(), attributesValuesMapEntry.getValue());
/** Adding into Xpath based on action [contains|equals etc...] an [@attribute='value'] */
}
}
}
}
}
return xpath;
}
示例10: getXPath
import com.google.common.collect.LinkedListMultimap; //导入依赖的package包/类
public String getXPath() {
String xpath = "";
if (xpathListMap.entries() != null) {
for (Map.Entry<LinkedListMultimap<XPathElement, LinkedList<ACTIONS>>, LinkedListMultimap<ATTRIBUTES, XPathValues>> mapEntry : xpathListMap.entries()) {
for (Map.Entry<XPathElement, LinkedList<ACTIONS>> elementActionsMapEntry : mapEntry.getKey().entries()) {
for (Map.Entry<PREFIX, ELEMENTS> elementEntry : elementActionsMapEntry.getKey().entries()) {
/** Adding into Xpath '// + element' or '/ + element' */
xpath = xpath + XPathBuilder.getElementXpath(elementEntry.getKey(), elementEntry.getValue());
/** Adding into Xpath '// + element' or '/ + element' */
LinkedList<ACTIONS> actions = elementActionsMapEntry.getValue();
for (ACTIONS action : actions) {
for (Map.Entry<ATTRIBUTES, XPathValues> attributesValuesMapEntry : mapEntry.getValue().entries()) {
ATTRIBUTES attributes = attributesValuesMapEntry.getKey();
XPathValues list = attributesValuesMapEntry.getValue();
/** Adding into Xpath based on action [contains|equals etc...] an [@attribute='value'] */
xpath = xpath + XPathBuilder.getXPath(action, attributes, list);
/** Adding into Xpath based on action [contains|equals etc...] an [@attribute='value'] */
}
}
}
}
}
return xpath;
}
return "//div[@id='ERROR IN XPath Generation']";
}
示例11: checkQuotaLimitNamesAreUnique
import com.google.common.collect.LinkedListMultimap; //导入依赖的package包/类
private void checkQuotaLimitNamesAreUnique(Quota quota) {
ListMultimap<String, QuotaLimit> limitNameCounts = LinkedListMultimap.create();
for (QuotaLimit limit : quota.getLimitsList()) {
limitNameCounts.put(limit.getName(), limit);
}
for (String limitName : limitNameCounts.keySet()) {
List<QuotaLimit> limits = limitNameCounts.get(limitName);
if (limits.size() > 1) {
error(
MessageLocationContext.create(Iterables.getLast(limits), "name"),
"There are %d quota limits with name '%s'.",
limits.size(),
limitName);
}
}
}
示例12: update
import com.google.common.collect.LinkedListMultimap; //导入依赖的package包/类
public void update() {
CaptureTypeService service = CaptureTypeService.getInstance();
VirtualFile dir = getCapturesDirectory();
Multimap<CaptureType, Capture> updated = LinkedListMultimap.create();
if (dir != null) {
VirtualFile[] children = VfsUtil.getChildren(dir);
for (CaptureType type : service.getCaptureTypes()) {
Set<VirtualFile> files = findCaptureFiles(children, type);
for (Capture capture : myCaptures.get(type)) {
// If an existing capture exists for a file, use it: Remove it from the files and add the already existing one.
if (files.remove(capture.getFile())) {
updated.put(type, capture);
}
}
for (VirtualFile newFile : files) {
updated.put(type, type.createCapture(newFile));
}
}
}
myCaptures = updated;
}
示例13: makeUnit
import com.google.common.collect.LinkedListMultimap; //导入依赖的package包/类
/**
* Build a unit of curves without the discount curve.
* @param instruments The instruments used for the unit calibration.
* @param initGuess The initial parameters guess.
* @param knownData The known data (fx rates, other curves, model parameters, ...)
* @param inflationMap The inflation curves names map.
* @param generatorsMap The generators map.
* @param calculator The calculator of the value on which the calibration is done (usually ParSpreadMarketQuoteCalculator (recommended) or converted present value).
* @param sensitivityCalculator The parameter sensitivity calculator.
* @return The new curves and the calibrated parameters.
*/
private InflationIssuerProviderDiscount makeUnit(final InstrumentDerivative[] instruments, final double[] initGuess,
final InflationIssuerProviderDiscount knownData,
LinkedHashMap<String, Currency> dscMap, LinkedHashMap<String, IndexON[]> fwdOnMap,
LinkedHashMap<String, IborIndex[]> fwdIborMap, LinkedHashMap<String, IndexPrice[]> priceMap,
LinkedListMultimap<String, Pair<Object, LegalEntityFilter<LegalEntity>>> issuerMap,
final LinkedHashMap<String, GeneratorCurve> generatorsMap,
final InstrumentDerivativeVisitor<ParameterInflationIssuerProviderInterface, Double> calculator,
final InstrumentDerivativeVisitor<ParameterInflationIssuerProviderInterface, InflationSensitivity> sensitivityCalculator) {
final GeneratorInflationIssuerProviderDiscount generator =
new GeneratorInflationIssuerProviderDiscount(knownData, dscMap, fwdOnMap, priceMap, issuerMap, generatorsMap);
final InflationIssuerDiscountBuildingData data = new InflationIssuerDiscountBuildingData(instruments, generator);
final Function1D<DoubleMatrix1D, DoubleMatrix1D> curveCalculator =
new InflationIssuerDiscountFinderFunction(calculator, data);
final Function1D<DoubleMatrix1D, DoubleMatrix2D> jacobianCalculator =
new InflationIssuerDiscountFinderJacobian(new ParameterSensitivityInflationIssuerMatrixCalculator(sensitivityCalculator),
data);
final double[] parameters = _rootFinder.getRoot(curveCalculator, jacobianCalculator, new DoubleMatrix1D(initGuess)).getData();
final InflationIssuerProviderDiscount newCurves = data.getGeneratorMarket().evaluate(new DoubleMatrix1D(parameters));
return newCurves;
}
示例14: makeUnit
import com.google.common.collect.LinkedListMultimap; //导入依赖的package包/类
/**
* Build a unit of curves.
* @param instruments The instruments used for the unit calibration.
* @param initGuess The initial parameters guess.
* @param knownData The known data (fx rates, other curves, model parameters, ...)
* @param discountingMap The discounting curves names map.
* @param forwardIborMap The forward curves names map.
* @param forwardONMap The forward curves names map.
* @param issuerMap The issuer curves names map.
* @param generatorsMap The generators map.
* @param calculator The calculator of the value on which the calibration is done (usually ParSpreadMarketQuoteCalculator (recommended) or converted present value).
* @param sensitivityCalculator The parameter sensitivity calculator.
* @return The new curves and the calibrated parameters.
*/
private IssuerProviderDiscount makeUnit(final InstrumentDerivative[] instruments,
final double[] initGuess,
final IssuerProviderDiscount knownData,
final LinkedHashMap<String, Currency> discountingMap,
final LinkedHashMap<String, IborIndex[]> forwardIborMap,
final LinkedHashMap<String, IndexON[]> forwardONMap,
final LinkedListMultimap<String, Pair<Object, LegalEntityFilter<LegalEntity>>> issuerMap,
final LinkedHashMap<String, GeneratorYDCurve> generatorsMap,
final InstrumentDerivativeVisitor<ParameterIssuerProviderInterface, Double> calculator,
final InstrumentDerivativeVisitor<ParameterIssuerProviderInterface, MulticurveSensitivity> sensitivityCalculator) {
final GeneratorIssuerProviderDiscount generator = new GeneratorIssuerProviderDiscount(knownData, discountingMap, forwardIborMap, forwardONMap, issuerMap, generatorsMap);
final IssuerDiscountBuildingData data = new IssuerDiscountBuildingData(instruments, generator);
final Function1D<DoubleMatrix1D, DoubleMatrix1D> curveCalculator = new IssuerDiscountFinderFunction(calculator, data);
// TODO: Create a way to select the SensitivityMatrixMulticurve calculator (with underlying curve or not)
final Function1D<DoubleMatrix1D, DoubleMatrix2D> jacobianCalculator = new IssuerDiscountFinderJacobian(new ParameterSensitivityIssuerMatrixCalculator(sensitivityCalculator), data);
final double[] parameters = _rootFinder.getRoot(curveCalculator, jacobianCalculator, new DoubleMatrix1D(initGuess)).getData();
final IssuerProviderDiscount newCurves = data.getGeneratorMarket().evaluate(new DoubleMatrix1D(parameters));
return newCurves;
}
示例15: createIssuerMap
import com.google.common.collect.LinkedListMultimap; //导入依赖的package包/类
/**
* Returns a map of curve names to issuer details where the curve
* configuration type is {@link IssuerCurveTypeConfiguration}.
*
* @param configTypes the configuration types of the curves, keyed by curve name
* @return a map of curve names to issuer details where the curve
* configuration type is {@link IssuerCurveTypeConfiguration}
*/
private LinkedListMultimap<String, Pair<Object, LegalEntityFilter<LegalEntity>>> createIssuerMap(
Multimap<String, CurveTypeConfiguration> configTypes) {
LinkedListMultimap<String, Pair<Object, LegalEntityFilter<LegalEntity>>> results = LinkedListMultimap.create();
for (Map.Entry<String, CurveTypeConfiguration> entry : configTypes.entries()) {
String curveName = entry.getKey();
CurveTypeConfiguration configType = entry.getValue();
if (configType instanceof IssuerCurveTypeConfiguration) {
IssuerCurveTypeConfiguration issuerType = (IssuerCurveTypeConfiguration) configType;
results.put(curveName, Pairs.<Object, LegalEntityFilter<LegalEntity>>of(issuerType.getKeys(), issuerType.getFilters()));
}
}
return results;
}