本文整理汇总了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, "")
)
);
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}