Java源码示例:com.carrotsearch.hppc.cursors.LongObjectCursor

示例1
@Test
public void testPerformance() {
    int trials = 10;
    int iterations = 100000;
    for (int k = 0; k < iterations; k++) {
        int len = random.nextInt(10);
        LongObjectHashMap<Object> map = new LongObjectHashMap<Object>();
        for (int i = 1; i <= len; i++) {
            map.put(i * 1000, "TestValue " + i);
        }
        for (int t = 0; t < trials; t++) {
            for (int i = 1; i <= len; i++) {
                assertEquals("TestValue " + i, map.get(i * 1000));
            }
            assertEquals(len, map.size());
            for (LongObjectCursor<Object> entry : map) {
            }
        }
    }
}
 
示例2
@Override
public String readPropertyName() {
    if (isProperty()) {
        return relationType.name();
    }

    LongObjectCursor<Object> next = propertiesIterator.next();
    nextPropertyValue = next.value;
    return relationTypes.get(next.key).name();

}
 
示例3
private void copyProperties(InternalRelation to) {
    for (LongObjectCursor<Object> entry : getPropertyMap()) {
        PropertyKey type = tx().getExistingPropertyKey(entry.key);
        if (!(type instanceof ImplicitKey))
            to.setPropertyDirect(type, entry.value);
    }
}
 
示例4
@Override
public Iterable<PropertyKey> getPropertyKeysDirect() {
    RelationCache map = getPropertyMap();
    List<PropertyKey> types = new ArrayList<>(map.numProperties());

    for (LongObjectCursor<Object> entry : map) {
        types.add(tx().getExistingPropertyKey(entry.key));
    }
    return types;
}
 
示例5
private void copyProperties(InternalRelation to) {
    for (LongObjectCursor<Object> entry : getPropertyMap()) {
        PropertyKey type = tx().getExistingPropertyKey(entry.key);
        if (!(type instanceof ImplicitKey))
            to.setPropertyDirect(type, entry.value);
    }
}
 
示例6
@Override
public Iterable<PropertyKey> getPropertyKeysDirect() {
    RelationCache map = getPropertyMap();
    List<PropertyKey> types = new ArrayList<>(map.numProperties());

    for (LongObjectCursor<Object> entry : map) {
        types.add(tx().getExistingPropertyKey(entry.key));
    }

    return types;
}
 
示例7
public Iterator<LongObjectCursor<Object>> propertyIterator() {
    return properties.iterator();
}
 
示例8
@Override
public Iterator<LongObjectCursor<Object>> iterator() {
    return propertyIterator();
}