本文整理汇总了Java中org.apache.commons.collections4.MultiValuedMap.put方法的典型用法代码示例。如果您正苦于以下问题:Java MultiValuedMap.put方法的具体用法?Java MultiValuedMap.put怎么用?Java MultiValuedMap.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.collections4.MultiValuedMap
的用法示例。
在下文中一共展示了MultiValuedMap.put方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.commons.collections4.MultiValuedMap; //导入方法依赖的package包/类
public static void main(String[] args)
{
MultiValuedMap<String, String> map = new ArrayListValuedHashMap<>();
map.put("one", "A");
System.out.println(map);
map.putAll("one", Arrays.asList("B", "C"));
System.out.println(map);
map.put("one", "D");
System.out.println(map);
map.putAll("two", Arrays.asList("1", "2", "3"));
System.out.println(map);
System.out.printf("The value of the one key: %s\n", map.get("one"));
}
示例2: Should_Use_User_Constructor_Parameters
import org.apache.commons.collections4.MultiValuedMap; //导入方法依赖的package包/类
@Test
void Should_Use_User_Constructor_Parameters() {
// given
final Class[] classesToTest = { ClassWithSyntheticConstructor.class };
final ConstructorParameters parameters = new ConstructorParameters(new Object[]{ "string" },
new Class[]{ String.class });
final MultiValuedMap<Class<?>, ConstructorParameters> constructorParameters = spy(new ArrayListValuedHashMap<>());
constructorParameters.put(ClassWithSyntheticConstructor.class, parameters);
final ConstructorTester constructorTester = new ConstructorTester();
constructorTester.setUserDefinedConstructors(constructorParameters);
// when
final Throwable result = catchThrowable(() -> constructorTester.testAll(classesToTest));
// then
assertThat(result).isNull();
verify(constructorParameters).get(ClassWithSyntheticConstructor.class);
}
示例3: Should_Create_Constructor_Parameters_When_Could_Not_Find_Matching_Constructor_Parameters_Types
import org.apache.commons.collections4.MultiValuedMap; //导入方法依赖的package包/类
@Test
void Should_Create_Constructor_Parameters_When_Could_Not_Find_Matching_Constructor_Parameters_Types() {
// given
final Class[] classesToTest = { ClassWithSyntheticConstructor.class };
final ConstructorParameters parameters = spy(new ConstructorParameters(new Object[]{ "to",
"many",
"parameters" },
new Class[]{ String.class,
String.class,
String.class }));
final MultiValuedMap<Class<?>, ConstructorParameters> constructorParameters = spy(new ArrayListValuedHashMap<>());
constructorParameters.put(ClassWithSyntheticConstructor.class, parameters);
final ConstructorTester constructorTester = new ConstructorTester();
constructorTester.setUserDefinedConstructors(constructorParameters);
// when
final Throwable result = catchThrowable(() -> constructorTester.testAll(classesToTest));
// then
assertThat(result).isNull();
verify(parameters, never()).getParameters();
}
示例4: processMQSCForAllEnvironments
import org.apache.commons.collections4.MultiValuedMap; //导入方法依赖的package包/类
private void processMQSCForAllEnvironments(XMLConfiguration config,
List<File> allMqscFiles,
List<ConfigurationNode> allMQSCEnvironments,
MultiValuedMap<String,String> allMQSCForEnvironment) {
for(ConfigurationNode rootConfigNode: allMQSCEnvironments){
String environment = rootConfigNode.getName();
for(File mqscFile: allMqscFiles){
try {
String originalfileContent = FileUtils.readFileToString(mqscFile, Charset.defaultCharset());
allMQSCForEnvironment.put(environment, originalfileContent);
} catch (IOException e) {
LOG.error(e.getMessage(), e);
}
}
}
}
示例5: setSegments
import org.apache.commons.collections4.MultiValuedMap; //导入方法依赖的package包/类
/**
* Sets the {@code WaySegment}s.
*
* @param edgeSegments
* a collection of way segments to store
*/
public void setSegments(Collection<WaySegment> edgeSegments) {
MultiValuedMap<WaySegmentId, WaySegment> res = new ArrayListValuedHashMap<>();
for (WaySegment segment : edgeSegments) {
res.put(segment.getId(), segment);
}
this.segments = res;
}
示例6: OSMData
import org.apache.commons.collections4.MultiValuedMap; //导入方法依赖的package包/类
/**
* Creates an new instance of {@code OSMData} of a {@link Set} of
* {@link Entity}s.
*
* @param entities
* set of {@code Entity}s to store
*/
public OSMData(Set<Entity> entities) {
this.boundingBox = null;
MultiValuedMap<Long, Entity> map = new ArrayListValuedHashMap<>();
for (Entity e : entities) {
if (e instanceof Bound)
this.boundingBox = (Bound) e;
map.put(e.getId(), e);
}
this.entities = map;
}
示例7: setEntities
import org.apache.commons.collections4.MultiValuedMap; //导入方法依赖的package包/类
/**
* Sets the entities
*
* @param entities
*/
protected void setEntities(Set<Entity> entities) {
MultiValuedMap<Long, Entity> map = new ArrayListValuedHashMap<>();
for (Entity e : entities) {
map.put(e.getId(), e);
}
this.entities = map;
}