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


Java HashTreePMap类代码示例

本文整理汇总了Java中org.pcollections.HashTreePMap的典型用法代码示例。如果您正苦于以下问题:Java HashTreePMap类的具体用法?Java HashTreePMap怎么用?Java HashTreePMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testEmpty

import org.pcollections.HashTreePMap; //导入依赖的package包/类
public void testEmpty() {
	PMap<?,?> empty = HashTreePMap.empty();
	UtilityTest.assertEqualsAndHash(new HashMap<Object,Object>(), empty);
	assertEquals(0, empty.size());
	assertTrue(empty.isEmpty());
	for(@SuppressWarnings("unused") Object e : empty.entrySet())
		fail();
}
 
开发者ID:google,项目名称:gulava,代码行数:9,代码来源:HashPMapTest.java

示例2: hasCycle

import org.pcollections.HashTreePMap; //导入依赖的package包/类
public static <T, K> boolean hasCycle(Forest<T, K> forest) {
    Checks.checkNotNull(forest, "forest must not be null");
    PMap<K, Node<T, K>> seen = HashTreePMap.empty();

    return forest
            .getAllNodes()
            .values()
            .stream()
            .anyMatch(node -> hasCycle(node, seen));
}
 
开发者ID:khartec,项目名称:waltz,代码行数:11,代码来源:HierarchyUtilities.java

示例3: of

import org.pcollections.HashTreePMap; //导入依赖的package包/类
public static Record of(Stream<Value> values) {
    /*
     * Collectors.toMap will call HashMap.merge() which will throw a NullPointerException if supplied with a null
     * for the value parameter, so filter out null values first.
     */
    return new HashRecord(HashTreePMap.from(values.filter(v -> null != v.value()).collect(Collectors.toMap(Value::key, Value::value))));
}
 
开发者ID:poetix,项目名称:octarine,代码行数:8,代码来源:Record.java

示例4: applyUnsafe

import org.pcollections.HashTreePMap; //导入依赖的package包/类
@Override
public PMap<String, V> applyUnsafe(JsonParser p) throws IOException {
    Map<String, V> values = new HashMap<>();

    if (p.nextToken() == JsonToken.END_OBJECT) {
        return HashTreePMap.empty();
    }
    while (p.nextValue() != JsonToken.END_OBJECT) {
        String fieldName = p.getCurrentName();
        values.put(fieldName, valueDeserialiser.apply(p));
    }

    return HashTreePMap.from(values);
}
 
开发者ID:poetix,项目名称:octarine,代码行数:15,代码来源:MapDeserialiser.java

示例5: applyUnsafe

import org.pcollections.HashTreePMap; //导入依赖的package包/类
@Override
public PMap<String, T> applyUnsafe(BsonValue p) throws BsonInvalidOperationException {
    BsonDocument doc = p.asDocument();
    Map<String, T> values = new HashMap<>();
    for (Map.Entry<String,BsonValue> e : doc.entrySet()) {
        values.put(e.getKey(), valueDeserialiser.apply(e.getValue()));
    }

    return HashTreePMap.from(values);
}
 
开发者ID:poetix,项目名称:octarine,代码行数:11,代码来源:BsonMapDeserialiser.java

示例6: testSingleton

import org.pcollections.HashTreePMap; //导入依赖的package包/类
public void testSingleton() {
	UtilityTest.assertEqualsAndHash(HashTreePMap.empty().plus(10, "test"),
			HashTreePMap.singleton(10, "test"));
}
 
开发者ID:google,项目名称:gulava,代码行数:5,代码来源:HashPMapTest.java

示例7: PcollectionsSetBuilder

import org.pcollections.HashTreePMap; //导入依赖的package包/类
PcollectionsSetBuilder() {
  super(MapPSet.from(HashTreePMap.empty()), set -> set::plus, PcollectionsSet::new);
}
 
开发者ID:msteindorfer,项目名称:criterion,代码行数:4,代码来源:PcollectionsSetBuilder.java

示例8: PcollectionsMapBuilder

import org.pcollections.HashTreePMap; //导入依赖的package包/类
PcollectionsMapBuilder() {
  super(HashTreePMap.empty(), map -> map::plus, PcollectionsMap::new);
}
 
开发者ID:msteindorfer,项目名称:criterion,代码行数:4,代码来源:PcollectionsMapBuilder.java

示例9: of

import org.pcollections.HashTreePMap; //导入依赖的package包/类
default Value of(Map<String, ? extends T> values) {
    return of(HashTreePMap.from(values));
}
 
开发者ID:poetix,项目名称:octarine,代码行数:4,代码来源:MapKey.java

示例10: dollar_methods

import org.pcollections.HashTreePMap; //导入依赖的package包/类
@Test public void
dollar_methods() {
    Key<String> name = $("name");
    Key<Integer> age = $("age");
    MapKey<String> phoneNumbers = $M("phoneNumbers");
    RecordKey address = $R("address");
    ListKey<String> addressLines = $L("addressLines");
    Key<String> postcode = $("postcode");

    Record person = $$(
            name.of("Peter Warlock"),
            age.of(43));

    Record numbers = $$(phoneNumbers.of(
            "home", "01234 567890",
            "work", "0208 1234567",
            "mobile", "07771 234567"
    ));

    Record personWithNumbers = $$(person, numbers);
    Record completePerson = $$(personWithNumbers, address.of(
            addressLines.of(
                    "23 Acacia Avenue",
                    "Sunderland"
            ),
            postcode.of("VB6 5UX")
    ));

    Map<String, String> expectedNumbers = new HashMap<>();
    expectedNumbers.put("home", "01234 567890");
    expectedNumbers.put("work", "0208 1234567");
    expectedNumbers.put("mobile", "07771 234567");

    assertThat(completePerson, ARecord.instance()
            .with(name, "Peter Warlock")
            .with(age, 43)
            .with(phoneNumbers, HashTreePMap.from(expectedNumbers))
            .with(address, $$(
                            addressLines.of("23 Acacia Avenue", "Sunderland"),
                            postcode.of("VB6 5UX")
                    )
            ));
}
 
开发者ID:poetix,项目名称:octarine,代码行数:44,代码来源:OctarineTest.java

示例11: forTable

import org.pcollections.HashTreePMap; //导入依赖的package包/类
public static TableMapping forTable(String tableName) {
    return new TableMapping(tableName, HashTreePMap.empty());
}
 
开发者ID:poetix,项目名称:octarine,代码行数:4,代码来源:TableMapping.java


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