本文整理汇总了Java中io.vavr.collection.TreeSet类的典型用法代码示例。如果您正苦于以下问题:Java TreeSet类的具体用法?Java TreeSet怎么用?Java TreeSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TreeSet类属于io.vavr.collection包,在下文中一共展示了TreeSet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testTreeSet
import io.vavr.collection.TreeSet; //导入依赖的package包/类
@Test
public void testTreeSet() throws Exception {
TreeSet<A> src = TreeSet.of(new B("a", "b"));
String json = MAPPER.writeValueAsString(new TreeSetPojo().setValue(src));
Assert.assertEquals(json, "{\"value\":[{\"ExtFieldsPojoTest$B\":{\"a\":\"a\",\"b\":\"b\"}}]}");
TreeSetPojo pojo = MAPPER.readValue(json, TreeSetPojo.class);
TreeSet<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");
}
开发者ID:vavr-io,项目名称:vavr-jackson,代码行数:12,代码来源:ExtFieldsPojoTest.java
示例2: testTreeSetOfString
import io.vavr.collection.TreeSet; //导入依赖的package包/类
@Test
public void testTreeSetOfString() throws Exception {
String src0 = "A";
String src1 = "B";
String src2 = "C";
TreeSet<String> src = TreeSet.of(src0, src1, src2);
String json = MAPPER.writeValueAsString(new ParameterizedTreeSetPojo<>(src));
Assert.assertEquals(json, "{\"value\":[\"A\",\"B\",\"C\"]}");
ParameterizedTreeSetPojo<java.lang.String> restored =
MAPPER.readValue(json, new TypeReference<ParameterizedTreeSetPojo<java.lang.String>>(){});
Assert.assertEquals(src, restored.getValue());
}
开发者ID:vavr-io,项目名称:vavr-jackson,代码行数:13,代码来源:ParameterizedPojoTest.java
示例3: testTreeSetOfTuple
import io.vavr.collection.TreeSet; //导入依赖的package包/类
@Test
public void testTreeSetOfTuple() throws Exception {
String src00 = "A";
String src01 = "B";
Tuple2<String, String> src0 = Tuple.of(src00, src01);
TreeSet<Tuple2<String, String>> src = TreeSet.of(src0);
String json = MAPPER.writeValueAsString(new ParameterizedTreeSetPojo<>(src));
Assert.assertEquals(json, "{\"value\":[[\"A\",\"B\"]]}");
ParameterizedTreeSetPojo<io.vavr.Tuple2<java.lang.String, java.lang.String>> restored =
MAPPER.readValue(json, new TypeReference<ParameterizedTreeSetPojo<io.vavr.Tuple2<java.lang.String, java.lang.String>>>(){});
Assert.assertEquals(src, restored.getValue());
}
开发者ID:vavr-io,项目名称:vavr-jackson,代码行数:13,代码来源:ParameterizedPojoTest.java
示例4: testTreeSetOfString
import io.vavr.collection.TreeSet; //导入依赖的package包/类
@Test
public void testTreeSetOfString() throws Exception {
String src0 = "A";
String src1 = "B";
String src2 = "C";
TreeSet<String> src = TreeSet.of(src0, src1, src2);
String json = MAPPER.writeValueAsString(new TreeSetOfString().setValue(src));
Assert.assertEquals(json, "{\"value\":[\"A\",\"B\",\"C\"]}");
TreeSetOfString restored = MAPPER.readValue(json, TreeSetOfString.class);
Assert.assertEquals(src, restored.getValue());
}
开发者ID:vavr-io,项目名称:vavr-jackson,代码行数:12,代码来源:SimplePojoTest.java
示例5: testTreeSetOfTuple
import io.vavr.collection.TreeSet; //导入依赖的package包/类
@Test
public void testTreeSetOfTuple() throws Exception {
String src00 = "A";
String src01 = "B";
Tuple2<String, String> src0 = Tuple.of(src00, src01);
TreeSet<Tuple2<String, String>> src = TreeSet.of(src0);
String json = MAPPER.writeValueAsString(new TreeSetOfTuple().setValue(src));
Assert.assertEquals(json, "{\"value\":[[\"A\",\"B\"]]}");
TreeSetOfTuple restored = MAPPER.readValue(json, TreeSetOfTuple.class);
Assert.assertEquals(src, restored.getValue());
}
开发者ID:vavr-io,项目名称:vavr-jackson,代码行数:12,代码来源:SimplePojoTest.java
示例6: testTreeSet
import io.vavr.collection.TreeSet; //导入依赖的package包/类
@Test
public void testTreeSet() throws Exception {
TreeSet<I> src = TreeSet.of(new B());
String json = MAPPER.writeValueAsString(new TreeSetPojo().setValue(src));
Assert.assertEquals(json, "{\"value\":[{\"type\":\"b\"}]}");
TreeSetPojo pojo = MAPPER.readValue(json, TreeSetPojo.class);
TreeSet<I> restored = pojo.getValue();
Assert.assertEquals(restored.filter(e -> e instanceof B).length(), 1);
}
开发者ID:vavr-io,项目名称:vavr-jackson,代码行数:10,代码来源:PolymorphicPojoTest.java
示例7: init
import io.vavr.collection.TreeSet; //导入依赖的package包/类
@PostConstruct
@PreDestroy
void init() {
notes = TreeSet.empty(COMPARATOR);
}
开发者ID:anton-tregubov,项目名称:javaee-design-patterns,代码行数:6,代码来源:NoteFacadeImpl.java
示例8: of
import io.vavr.collection.TreeSet; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
TreeSet<?> of(Object... arr) {
return TreeSet.ofAll((o1, o2) -> ((Comparable) o1).compareTo(o2), Arrays.asList(arr));
}
开发者ID:vavr-io,项目名称:vavr-gson,代码行数:6,代码来源:TreeSetTest.java
示例9: clz
import io.vavr.collection.TreeSet; //导入依赖的package包/类
@Override
Class<?> clz() {
return TreeSet.class;
}
开发者ID:vavr-io,项目名称:vavr-gson,代码行数:5,代码来源:TreeSetTest.java
示例10: type
import io.vavr.collection.TreeSet; //导入依赖的package包/类
@Override
Type type() {
return new TypeToken<TreeSet<Integer>>(){}.getType();
}
开发者ID:vavr-io,项目名称:vavr-gson,代码行数:5,代码来源:TreeSetTest.java
示例11: typeWithNestedType
import io.vavr.collection.TreeSet; //导入依赖的package包/类
@Override
Type typeWithNestedType() {
return new TypeToken<TreeSet<TreeSet<Integer>>>(){}.getType();
}
开发者ID:vavr-io,项目名称:vavr-gson,代码行数:5,代码来源:TreeSetTest.java
示例12: splitIntoUUIDs
import io.vavr.collection.TreeSet; //导入依赖的package包/类
public static SortedSet<UUID> splitIntoUUIDs(String commaSeparatedUuids) {
return Arrays.stream(commaSeparatedUuids.split(","))
.map(UUID::fromString)
.collect(TreeSet.collector());
}
开发者ID:Tradeshift,项目名称:ts-reaktive,代码行数:6,代码来源:UUIDs.java
示例13: emptyPersistentSortedSet
import io.vavr.collection.TreeSet; //导入依赖的package包/类
public static <T extends Comparable<? super T>> VavrTreeSetX<T> emptyPersistentSortedSet() {
return new VavrTreeSetX<T>(TreeSet.empty());
}
开发者ID:aol,项目名称:cyclops,代码行数:4,代码来源:VavrTreeSetX.java
示例14: empty
import io.vavr.collection.TreeSet; //导入依赖的package包/类
public static <T extends Comparable<? super T>> LazyPOrderedSetX<T> empty() {
return fromPersistentSortedSet(new VavrTreeSetX<T>(
TreeSet.empty()),toPersistentSortedSet());
}
开发者ID:aol,项目名称:cyclops,代码行数:5,代码来源:VavrTreeSetX.java
示例15: singleton
import io.vavr.collection.TreeSet; //导入依赖的package包/类
public static <T extends Comparable<? super T>> LazyPOrderedSetX<T> singleton(T t) {
return fromPersistentSortedSet(new VavrTreeSetX<>(
TreeSet.of(t)),toPersistentSortedSet());
}
开发者ID:aol,项目名称:cyclops,代码行数:5,代码来源:VavrTreeSetX.java
示例16: of
import io.vavr.collection.TreeSet; //导入依赖的package包/类
public static <T extends Comparable<? super T>> LazyPOrderedSetX<T> of(T... t) {
return fromPersistentSortedSet(new VavrTreeSetX<>(
TreeSet.of(t)),toPersistentSortedSet());
}
开发者ID:aol,项目名称:cyclops,代码行数:5,代码来源:VavrTreeSetX.java
示例17: treeSetConcat
import io.vavr.collection.TreeSet; //导入依赖的package包/类
static <T extends Comparable<T>> Monoid<TreeSet<T>> treeSetConcat() {
return VavrMonoids.<T,TreeSet<T>>setConcat(TreeSet.empty(Comparator.naturalOrder()));
}
开发者ID:aol,项目名称:cyclops,代码行数:4,代码来源:VavrMonoids.java
示例18: firstNonEmptyTreeSet
import io.vavr.collection.TreeSet; //导入依赖的package包/类
static <T extends Comparable<T>> Monoid<TreeSet<T>> firstNonEmptyTreeSet() {
return VavrMonoids.<T,TreeSet<T>>firstNonEmptySet(TreeSet.empty());
}
开发者ID:aol,项目名称:cyclops,代码行数:4,代码来源:VavrMonoids.java
示例19: lastNonEmptyTreeSet
import io.vavr.collection.TreeSet; //导入依赖的package包/类
static <T extends Comparable<T>> Monoid<TreeSet<T>> lastNonEmptyTreeSet() {
return VavrMonoids.<T,TreeSet<T>>lastNonEmptySet(TreeSet.empty());
}
开发者ID:aol,项目名称:cyclops,代码行数:4,代码来源:VavrMonoids.java
示例20: treeSetConcat
import io.vavr.collection.TreeSet; //导入依赖的package包/类
static <T> Semigroup<TreeSet<T>> treeSetConcat() {
return VavrSemigroups.setConcat();
}
开发者ID:aol,项目名称:cyclops,代码行数:4,代码来源:VavrSemigroups.java
注:本文中的io.vavr.collection.TreeSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论