本文整理了Java中io.vavr.collection.HashSet.head()
方法的一些代码示例,展示了HashSet.head()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HashSet.head()
方法的具体详情如下:
包路径:io.vavr.collection.HashSet
类名称:HashSet
方法名:head
暂无
代码示例来源:origin: vavr-io/vavr
@Override
public HashSet<T> tail() {
if (tree.isEmpty()) {
throw new UnsupportedOperationException("tail of empty set");
}
return remove(head());
}
代码示例来源:origin: io.vavr/vavr
@Override
public HashSet<T> tail() {
if (tree.isEmpty()) {
throw new UnsupportedOperationException("tail of empty set");
}
return remove(head());
}
代码示例来源:origin: vavr-io/vavr-jackson
@Test
public void testHashSetClass() throws Exception {
HashSetClass src = new HashSetClass(HashSet.of(new ImplementedClass()));
String json = MAPPER.writeValueAsString(src);
HashSetClass restored = MAPPER.readValue(json, HashSetClass.class);
Assert.assertEquals(restored.value.head().getClass(), ImplementedClass.class);
}
代码示例来源:origin: vavr-io/vavr-jackson
@Test
public void testHashSet() throws Exception {
HashSet<A> src = HashSet.of(new B("a", "b"));
String json = MAPPER.writeValueAsString(new HashSetPojo().setValue(src));
Assert.assertEquals(json, "{\"value\":[{\"ExtFieldsPojoTest$B\":{\"a\":\"a\",\"b\":\"b\"}}]}");
HashSetPojo pojo = MAPPER.readValue(json, HashSetPojo.class);
HashSet<A> restored = pojo.getValue();
Assert.assertEquals(restored.filter(e -> e instanceof B).length(), 1);
Assert.assertEquals(restored.head().a, "a");
Assert.assertEquals(((B) restored.head()).b, "b");
}
内容来源于网络,如有侵权,请联系作者删除!