当前位置: 首页>>代码示例>>Java>>正文


Java MultiValuedMap.put方法代码示例

本文整理汇总了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"));
}
 
开发者ID:developerSid,项目名称:AwesomeJavaLibraryExamples,代码行数:19,代码来源:ExampleMultiValueMap.java

示例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);
}
 
开发者ID:sta-szek,项目名称:pojo-tester,代码行数:21,代码来源:ConstructorTesterTest.java

示例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();
}
 
开发者ID:sta-szek,项目名称:pojo-tester,代码行数:25,代码来源:ConstructorTesterTest.java

示例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);
			}
		}
	}
}
 
开发者ID:anair-it,项目名称:wmq-mqsc-mojo,代码行数:18,代码来源:MqscMojo.java

示例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;
}
 
开发者ID:biggis-project,项目名称:path-optimizer,代码行数:14,代码来源:WaySegments.java

示例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;
}
 
开发者ID:biggis-project,项目名称:path-optimizer,代码行数:18,代码来源:OSMData.java

示例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;
}
 
开发者ID:biggis-project,项目名称:path-optimizer,代码行数:13,代码来源:OSMData.java


注:本文中的org.apache.commons.collections4.MultiValuedMap.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。