本文整理汇总了Java中com.google.common.collect.LinkedHashMultimap.put方法的典型用法代码示例。如果您正苦于以下问题:Java LinkedHashMultimap.put方法的具体用法?Java LinkedHashMultimap.put怎么用?Java LinkedHashMultimap.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.LinkedHashMultimap
的用法示例。
在下文中一共展示了LinkedHashMultimap.put方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildHandCardMultimap
import com.google.common.collect.LinkedHashMultimap; //导入方法依赖的package包/类
private LinkedHashMultimap<Hand, Card> buildHandCardMultimap() {
LinkedHashMultimap<Hand, Card> multimap = LinkedHashMultimap.create();
multimap.put(EAST, CLUB_8);
multimap.put(EAST, SPADE_8);
multimap.put(EAST, DIAMOND_7);
multimap.put(EAST, DIAMOND_8);
multimap.put(SOUTH, CLUB_ACE);
multimap.put(SOUTH, CLUB_KING);
multimap.put(SOUTH, DIAMOND_9);
multimap.put(SOUTH, DIAMOND_10);
multimap.put(WEST, CLUB_JACK);
multimap.put(WEST, CLUB_9);
multimap.put(WEST, HEART_JACK);
multimap.put(WEST, DIAMOND_JACK);
multimap.put(WEST, DIAMOND_QUEEN);
return multimap;
}
示例2: testsList
import com.google.common.collect.LinkedHashMultimap; //导入方法依赖的package包/类
private LinkedHashMultimap<String, String> testsList() throws Exception {
LinkedHashMultimap<String, String> testListDropDown = LinkedHashMultimap.create();
User user = User.getUser(utils);
List<Account> accounts = user.getAccounts();
for (Account a : accounts) {
List<Workspace> workspaces = a.getWorkspaces();
List<AbstractTest> tests = new ArrayList<>();
for (Workspace wsp : workspaces) {
tests.clear();
addMultiTests(wsp, tests);
addSingleTests(wsp, tests);
Comparator<AbstractTest> c = (AbstractTest t1, AbstractTest t2) -> t1.getName().compareToIgnoreCase(t2.getName());
tests.sort(c);
testListDropDown.put(WORKSPACE + wsp.getId(), "===" + wsp.getName() + "(" + wsp.getId() + ")===");
if (tests.isEmpty()) {
testListDropDown.put("no-tests"+workspaces.indexOf(wsp), "No tests in workspace");
continue;
}
for (AbstractTest t : tests) {
String testIdType = t.getId() + "." + t.getTestType();
testListDropDown.put(testIdType, t.getName() + "(" + testIdType + ")");
}
}
}
return testListDropDown;
}
示例3: testCreate
import com.google.common.collect.LinkedHashMultimap; //导入方法依赖的package包/类
@Test
public void testCreate() {
LinkedHashMultimap<String, String> linkedHashMultimap = LinkedHashMultimap.create();
linkedHashMultimap.put("user", "jim");
linkedHashMultimap.put("user", "jack");
linkedHashMultimap.put("user", "jack");
linkedHashMultimap.put("user", "lilei");
System.out.println(linkedHashMultimap); // {user=[jim, jack, lilei]}
}
示例4: index
import com.google.common.collect.LinkedHashMultimap; //导入方法依赖的package包/类
/**
* indexes the IEObject description using the given
*/
public static <T> Multimap<T,IEObjectDescription> index(Iterable<IEObjectDescription> descriptions, Function<IEObjectDescription,T> indexer) {
ArrayList<IEObjectDescription> list = Lists.newArrayList(descriptions);
LinkedHashMultimap<T, IEObjectDescription> multimap = LinkedHashMultimap.create(list.size(),1);
for (IEObjectDescription desc : list) {
multimap.put(indexer.apply(desc), desc);
}
return multimap;
}
示例5: genCondition
import com.google.common.collect.LinkedHashMultimap; //导入方法依赖的package包/类
private StringConcatenationClient genCondition(final List<ISerializationContext> contexts, final IGrammarConstraintProvider.IConstraint constraint, final Multimap<EObject, IGrammarConstraintProvider.IConstraint> ctx2ctr) {
StringConcatenationClient _xblockexpression = null;
{
final List<ISerializationContext> sorted = IterableExtensions.<ISerializationContext>sort(contexts);
final LinkedHashMultimap<EObject, ISerializationContext> index = LinkedHashMultimap.<EObject, ISerializationContext>create();
final Consumer<ISerializationContext> _function = (ISerializationContext it) -> {
index.put(this.getContextObject(it), it);
};
sorted.forEach(_function);
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
{
Set<EObject> _keySet = index.keySet();
boolean _hasElements = false;
for(final EObject obj : _keySet) {
if (!_hasElements) {
_hasElements = true;
} else {
_builder.appendImmediate("\n\t\t|| ", "");
}
StringConcatenationClient _genObjectSelector = SerializerFragment2.this.genObjectSelector(obj);
_builder.append(_genObjectSelector);
{
int _size = ctx2ctr.get(obj).size();
boolean _greaterThan = (_size > 1);
if (_greaterThan) {
StringConcatenationClient _genParameterSelector = SerializerFragment2.this.genParameterSelector(obj, index.get(obj), constraint);
_builder.append(_genParameterSelector);
}
}
}
}
}
};
_xblockexpression = _client;
}
return _xblockexpression;
}
示例6: createDeviceMaps
import com.google.common.collect.LinkedHashMultimap; //导入方法依赖的package包/类
/**
* Move the propriety {@link HardwareMap.DeviceMapping} to our {@link DeviceMap} for our
* internal use
*/
private void createDeviceMaps() {
fullMap.checkedPut(DcMotorController.class, new DeviceMap<>(basicMap.dcMotorController));
fullMap.checkedPut(DcMotor.class, new DeviceMap<>(basicMap.dcMotor));
fullMap.checkedPut(ServoController.class, new DeviceMap<>(basicMap.servoController));
fullMap.checkedPut(Servo.class, new DeviceMap<>(basicMap.servo));
fullMap.checkedPut(LegacyModule.class, new DeviceMap<>(basicMap.legacyModule));
fullMap.checkedPut(TouchSensorMultiplexer.class, new DeviceMap<>(basicMap.touchSensorMultiplexer));
fullMap.checkedPut(DeviceInterfaceModule.class, new DeviceMap<>(basicMap.deviceInterfaceModule));
fullMap.checkedPut(AnalogInput.class, new DeviceMap<>(basicMap.analogInput));
fullMap.checkedPut(DigitalChannel.class, new DeviceMap<>(basicMap.digitalChannel));
fullMap.checkedPut(OpticalDistanceSensor.class, new DeviceMap<>(basicMap.opticalDistanceSensor));
fullMap.checkedPut(TouchSensor.class, new DeviceMap<>(basicMap.touchSensor));
fullMap.checkedPut(PWMOutput.class, new DeviceMap<>(basicMap.pwmOutput));
fullMap.checkedPut(I2cDevice.class, new DeviceMap<>(basicMap.i2cDevice));
fullMap.checkedPut(AnalogOutput.class, new DeviceMap<>(basicMap.analogOutput));
fullMap.checkedPut(ColorSensor.class, new DeviceMap<>(basicMap.colorSensor));
fullMap.checkedPut(LED.class, new DeviceMap<>(basicMap.led));
fullMap.checkedPut(AccelerationSensor.class, new DeviceMap<>(basicMap.accelerationSensor));
fullMap.checkedPut(CompassSensor.class, new DeviceMap<>(basicMap.compassSensor));
fullMap.checkedPut(GyroSensor.class, new DeviceMap<>(basicMap.gyroSensor));
fullMap.checkedPut(IrSeekerSensor.class, new DeviceMap<>(basicMap.irSeekerSensor));
fullMap.checkedPut(LightSensor.class, new DeviceMap<>(basicMap.lightSensor));
fullMap.checkedPut(UltrasonicSensor.class, new DeviceMap<>(basicMap.ultrasonicSensor));
fullMap.checkedPut(VoltageSensor.class, new DeviceMap<>(basicMap.voltageSensor));
LinkedHashMultimap<DcMotorController, DcMotor> multimap = LinkedHashMultimap.create();
for (DcMotor motor : dcMotors()) {
multimap.put(motor.getController(), motor);
}
}
示例7: toFormValueElements
import com.google.common.collect.LinkedHashMultimap; //导入方法依赖的package包/类
private Multimap<String, FormValueElement> toFormValueElements(Multimap<String, Map<String, Object>> elements) {
if (elements == null) {
return LinkedHashMultimap.create();
}
LinkedHashMultimap<String, FormValueElement> formValueElements = LinkedHashMultimap.create();
for (Map.Entry<String, Map<String, Object>> entry: elements.entries()) {
formValueElements.put(entry.getKey(), toFormValueElement(entry.getValue()));
}
return formValueElements;
}
示例8: addSearchResultsToCurrentWaveView
import com.google.common.collect.LinkedHashMultimap; //导入方法依赖的package包/类
private void addSearchResultsToCurrentWaveView(
LinkedHashMultimap<WaveId, WaveletId> currentUserWavesView, JsonArray docsJson) {
for (JsonElement aDocsJson : docsJson) {
JsonObject docJson = aDocsJson.getAsJsonObject();
WaveId waveId = WaveId.deserialise(docJson.getAsJsonPrimitive(WAVE_ID).getAsString());
WaveletId waveletId =
WaveletId.deserialise(docJson.getAsJsonPrimitive(WAVELET_ID).getAsString());
currentUserWavesView.put(waveId, waveletId);
}
}
示例9: addReduceAction
import com.google.common.collect.LinkedHashMultimap; //导入方法依赖的package包/类
private void addReduceAction(IProduction p, Integer label, CharacterClass cc, CharacterClass[] lookahead) {
CharacterClass final_range = cc;
ParseTableProduction prod = pt.productionsMapping().get(p);
LinkedHashMultimap<CharacterClass, Action> newLR_actions = LinkedHashMultimap.create();;
for(CharacterClass range : lr_actions.keySet()) {
if(final_range.isEmptyCC()) {
break;
}
CharacterClass intersection = CharacterClass.intersection(final_range, range);
if(!intersection.isEmptyCC()) {
if(intersection.equals(range)) {
if(lookahead != null) {
newLR_actions.put(intersection, new ReduceLookahead(prod, label, intersection, lookahead));
} else {
newLR_actions.put(intersection, new Reduce(prod, label, intersection));
}
final_range = final_range.difference(intersection);
}
}
}
lr_actions.putAll(newLR_actions);
if(!final_range.isEmptyCC()) {
if(lookahead != null) {
lr_actions.put(final_range, new ReduceLookahead(prod, label, final_range, lookahead));
} else {
lr_actions.put(final_range, new Reduce(prod, label, final_range));
}
}
}
示例10: computeMissingApiMethods
import com.google.common.collect.LinkedHashMultimap; //导入方法依赖的package包/类
/**
* Looking for at.ProvidesDefaultImplementation on Methods. Normal method declarations are not taken into account,
* since they would not be executed on the interface level.
*
* Beware: also the inheritance in the original API will be taken into account since compiled client code will link
* against that.
*
* @param type
* type to search for apis.
* @return List of {@link VirtualApiTMethod}
*/
public List<TMethod> computeMissingApiMethods(TInterface type, EObject context) {
Optional<ProjectComparisonAdapter> optAdapt = firstProjectComparisonAdapter(context.eResource());
if (optAdapt.isPresent()) {
ProjectComparisonAdapter projectComparisonAdapter = optAdapt.get();
ProjectComparisonEntry compareEntry = projectComparisonAdapter.getEntryFor(
EcoreUtil2.getContainerOfType(type, TModule.class));
ProjectComparisonEntry typeCompare = compareEntry.getChildForElementImpl(type);
// compute real super-types and API-missing super-types then add result for each going through
// computeMissingApiMethodsPlain.
if (typeCompare == null) {
// are we in a completely missing API implementation (super-interfaces not implemented ?)
typeCompare = compareEntry.getChildForElementAPI(type);
}
if (typeCompare == null) {
if (logger.isDebugEnabled()) {
logger.debug(
" want to throw new IllegalstateException() --> comparison for implementation not found type="
+ type.getTypeAsString()
+ " in Implementation " + compareEntry.getElementImpl()[0]);
}
return emptyList();
}
LinkedHashMultimap<TMethod, TInterface> lhmmMehodInterface = LinkedHashMultimap
.<TMethod, TInterface> create();
Predicate<ProjectComparisonEntry> filter = (pce -> pce.getElementAPI() instanceof TMethod);
filter = filter
.and(pce -> pce.getElementImpl()[0] == null)
.and(pce -> PROVIDES_DEFAULT_IMPLEMENTATION.hasAnnotation((TMethod) pce.getElementAPI()));
Function<TInterface, Consumer<? super ProjectComparisonEntry>> actionProvider = pivot -> pce -> {
TMethod method = ((TMethod) pce.getElementAPI());
lhmmMehodInterface.put(method, pivot);
};
if (!checkInterfaceImplementsInterface(type, typeCompare.getElementAPI())) {
return emptyList();
}
// Call the supertype iterations scaffolding:
interfaceApiSupertypeWalker(filter, actionProvider, projectComparisonAdapter,
(TInterface) typeCompare.getElementAPI(), TInterface.class);
// now that we know about expected mixed-in methods we need to filter out
// given concrete implementations overriding these mix-ins ... mmmhhh this should be
// done when calculating the outer concrete super-member computation. --> the result we found here should be
// filtered
// out in the caller when processing our results...
return lhmmMehodInterface
.keySet()
.stream()
.map(m -> new VirtualApiTMethod(m.getName(), TypeUtils.copyPartial(m,
TypesPackage.Literals.SYNTAX_RELATED_TELEMENT__AST_ELEMENT)))
.collect(Collectors.toList());
}
return emptyList();
}
示例11: generateLinkedHashMultimap
import com.google.common.collect.LinkedHashMultimap; //导入方法依赖的package包/类
@Generates private static <K, V> LinkedHashMultimap<K, V> generateLinkedHashMultimap(
K key, V value) {
LinkedHashMultimap<K, V> multimap = LinkedHashMultimap.create();
multimap.put(key, value);
return multimap;
}
示例12: generateLinkedHashMultimap
import com.google.common.collect.LinkedHashMultimap; //导入方法依赖的package包/类
@Generates
private static <K, V> LinkedHashMultimap<K, V> generateLinkedHashMultimap(K key, V value) {
LinkedHashMultimap<K, V> multimap = LinkedHashMultimap.create();
multimap.put(key, value);
return multimap;
}
示例13: toMultimap
import com.google.common.collect.LinkedHashMultimap; //导入方法依赖的package包/类
/**
* Transforms Cursor to LinkedHashMultimap<TKey, TValue> by applying given
* functions. The iteration order for the returned map is the same as
* the iteration order over rows of Cursor.
* WARNING: This method closes cursor. Do not use this from onLoadFinished()
*
* @param keyTransform Function to apply on every single row of this cursor
* to get the key of the entry representing this row.
* @param valueTransform Function to apply on every single row of this cursor
* to get the value of the entry representing this row.
* @param <TKey> Type of keys in the returned multimap
* @param <TValue> Type of values in the returned multimap
* @return Transformed map
*/
public <TKey, TValue> LinkedHashMultimap<TKey, TValue> toMultimap(Function<? super Cursor, TKey> keyTransform, Function<? super Cursor, TValue> valueTransform) {
try {
LinkedHashMultimap<TKey, TValue> result = LinkedHashMultimap.create(getCount(), 1);
for (moveToFirst(); !isAfterLast(); moveToNext()) {
result.put(keyTransform.apply(this), valueTransform.apply(this));
}
return result;
} finally {
close();
}
}