當前位置: 首頁>>代碼示例>>Java>>正文


Java LinkedListMultimap類代碼示例

本文整理匯總了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;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:26,代碼來源:PolyfillValidatorFragment.java

示例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;
}
 
開發者ID:Applications-Development,項目名稱:SimpleRssReader,代碼行數:21,代碼來源:SharedPrefUtils.java

示例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;
}
 
開發者ID:Applications-Development,項目名稱:SimpleRssReader,代碼行數:18,代碼來源:SharedPrefUtils.java

示例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);
}
 
開發者ID:Applications-Development,項目名稱:SimpleRssReader,代碼行數:20,代碼來源:SharedPrefUtils.java

示例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++;
    }
}
 
開發者ID:Applications-Development,項目名稱:SimpleRssReader,代碼行數:23,代碼來源:SharedPrefUtils.java

示例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);
}
 
開發者ID:Applications-Development,項目名稱:SimpleRssReader,代碼行數:18,代碼來源:SharedPrefUtils.java

示例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();
}
 
開發者ID:flapdoodle-oss,項目名稱:de.flapdoodle.solid,代碼行數:17,代碼來源:Collectors.java

示例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;
}
 
開發者ID:google,項目名稱:schemaorg-java,代碼行數:26,代碼來源:JsonLdSerializer.java

示例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;
}
 
開發者ID:ViliamS,項目名稱:XPathBuilder,代碼行數:21,代碼來源:IXPath.java

示例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']";
}
 
開發者ID:ViliamS,項目名稱:XPathBuilder,代碼行數:27,代碼來源:XPath.java

示例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);
    }
  }
}
 
開發者ID:googleapis,項目名稱:api-compiler,代碼行數:17,代碼來源:QuotaLimitNameValidator.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:CaptureService.java

示例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;
}
 
開發者ID:DevStreet,項目名稱:FinanceAnalytics,代碼行數:32,代碼來源:InflationIssuerDiscountBuildingRepository.java

示例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;
}
 
開發者ID:DevStreet,項目名稱:FinanceAnalytics,代碼行數:34,代碼來源:IssuerDiscountBuildingRepository.java

示例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;
}
 
開發者ID:DevStreet,項目名稱:FinanceAnalytics,代碼行數:25,代碼來源:IssuerMulticurveMarketDataBuilder.java


注:本文中的com.google.common.collect.LinkedListMultimap類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。