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


Java HashMap.ofEntries方法代码示例

本文整理汇总了Java中io.vavr.collection.HashMap.ofEntries方法的典型用法代码示例。如果您正苦于以下问题:Java HashMap.ofEntries方法的具体用法?Java HashMap.ofEntries怎么用?Java HashMap.ofEntries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vavr.collection.HashMap的用法示例。


在下文中一共展示了HashMap.ofEntries方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import io.vavr.collection.HashMap; //导入方法依赖的package包/类
public static AppState create() {
	return new AppState(Project.create(),
		HashMap.ofEntries(
			Tuple.of(TextFieldID.SPRINT_TITLE, ""),
			Tuple.of(TextFieldID.STORY_TITLE, "")
		)
	);
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:9,代码来源:AppState.java

示例2: testHashMapOfString

import io.vavr.collection.HashMap; //导入方法依赖的package包/类
@Test
public void testHashMapOfString() throws Exception {
    Integer src00 = 1;
    String src01 = "A";
    Tuple2<Integer, String> src0 = Tuple.of(src00, src01);
    HashMap<Integer, String> src = HashMap.ofEntries(src0);
    String json = MAPPER.writeValueAsString(new ParameterizedHashMapPojo<>(src));
    Assert.assertEquals(json, "{\"value\":{\"1\":\"A\"}}");
    ParameterizedHashMapPojo<java.lang.Integer, java.lang.String> restored = 
            MAPPER.readValue(json, new TypeReference<ParameterizedHashMapPojo<java.lang.Integer, java.lang.String>>(){});
    Assert.assertEquals(src, restored.getValue());
}
 
开发者ID:vavr-io,项目名称:vavr-jackson,代码行数:13,代码来源:ParameterizedPojoTest.java

示例3: testHashMapOfTuple

import io.vavr.collection.HashMap; //导入方法依赖的package包/类
@Test
public void testHashMapOfTuple() throws Exception {
    Integer src00 = 1;
    String src010 = "A";
    String src011 = "B";
    Tuple2<String, String> src01 = Tuple.of(src010, src011);
    Tuple2<Integer, Tuple2<String, String>> src0 = Tuple.of(src00, src01);
    HashMap<Integer, Tuple2<String, String>> src = HashMap.ofEntries(src0);
    String json = MAPPER.writeValueAsString(new ParameterizedHashMapPojo<>(src));
    Assert.assertEquals(json, "{\"value\":{\"1\":[\"A\",\"B\"]}}");
    ParameterizedHashMapPojo<java.lang.Integer, io.vavr.Tuple2<java.lang.String, java.lang.String>> restored = 
            MAPPER.readValue(json, new TypeReference<ParameterizedHashMapPojo<java.lang.Integer, io.vavr.Tuple2<java.lang.String, java.lang.String>>>(){});
    Assert.assertEquals(src, restored.getValue());
}
 
开发者ID:vavr-io,项目名称:vavr-jackson,代码行数:15,代码来源:ParameterizedPojoTest.java

示例4: testHashMapOfString

import io.vavr.collection.HashMap; //导入方法依赖的package包/类
@Test
public void testHashMapOfString() throws Exception {
    Integer src00 = 1;
    String src01 = "A";
    Tuple2<Integer, String> src0 = Tuple.of(src00, src01);
    HashMap<Integer, String> src = HashMap.ofEntries(src0);
    String json = MAPPER.writeValueAsString(new HashMapOfString().setValue(src));
    Assert.assertEquals(json, "{\"value\":{\"1\":\"A\"}}");
    HashMapOfString restored = MAPPER.readValue(json, HashMapOfString.class);
    Assert.assertEquals(src, restored.getValue());
}
 
开发者ID:vavr-io,项目名称:vavr-jackson,代码行数:12,代码来源:SimplePojoTest.java

示例5: testHashMapOfTuple

import io.vavr.collection.HashMap; //导入方法依赖的package包/类
@Test
public void testHashMapOfTuple() throws Exception {
    Integer src00 = 1;
    String src010 = "A";
    String src011 = "B";
    Tuple2<String, String> src01 = Tuple.of(src010, src011);
    Tuple2<Integer, Tuple2<String, String>> src0 = Tuple.of(src00, src01);
    HashMap<Integer, Tuple2<String, String>> src = HashMap.ofEntries(src0);
    String json = MAPPER.writeValueAsString(new HashMapOfTuple().setValue(src));
    Assert.assertEquals(json, "{\"value\":{\"1\":[\"A\",\"B\"]}}");
    HashMapOfTuple restored = MAPPER.readValue(json, HashMapOfTuple.class);
    Assert.assertEquals(src, restored.getValue());
}
 
开发者ID:vavr-io,项目名称:vavr-jackson,代码行数:14,代码来源:SimplePojoTest.java


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