use of java.util.Spliterator in project mapdb by jankotek.
the class LinkedBlockingQueue8Test method testSpliterator_characteristics.
/**
* Spliterator characteristics are as advertised
*/
public void testSpliterator_characteristics() {
LinkedBlockingQueue q = new LinkedBlockingQueue();
Spliterator s = q.spliterator();
int characteristics = s.characteristics();
int required = Spliterator.CONCURRENT | Spliterator.NONNULL | Spliterator.ORDERED;
assertEquals(required, characteristics & required);
assertTrue(s.hasCharacteristics(required));
assertEquals(0, characteristics & (Spliterator.DISTINCT | Spliterator.IMMUTABLE | Spliterator.SORTED));
}
use of java.util.Spliterator in project timbuctoo by HuygensING.
the class ChangeLog method getProvenanceChanges.
protected Stream<Change> getProvenanceChanges(DataSet dataSet, String[] subjects, CustomProvenance provenance, Map<String, JsonNode> values) {
TypeNameStore typeNameStore = dataSet.getTypeNameStore();
Stream<Change> customProv = provenance.getFields().stream().filter(field -> field.getValueType() != null).flatMap(field -> {
String graphQlPred = typeNameStore.makeGraphQlnameForPredicate(field.getUri(), Direction.OUT, field.isList());
return Stream.of(subjects).map(subject -> new Change(subject, field.getUri(), getValues(dataSet, values.get(graphQlPred)), Stream.empty()));
});
Stream<Change> customProvNested = provenance.getFields().stream().filter(field -> field.getObject() != null).flatMap(field -> {
String graphQlPred = typeNameStore.makeGraphQlnameForPredicate(field.getUri(), Direction.OUT, field.isList());
JsonNode objectValues = values.get(graphQlPred);
if (objectValues.isArray()) {
Spliterator<JsonNode> spliterator = Spliterators.spliteratorUnknownSize(objectValues.iterator(), Spliterator.ORDERED);
return StreamSupport.stream(spliterator, false).flatMap(newObjectValues -> getChangesForProvObject(dataSet, newObjectValues, subjects, field));
}
return getChangesForProvObject(dataSet, objectValues, subjects, field);
});
return Stream.concat(customProv, customProvNested);
}
use of java.util.Spliterator in project timbuctoo by HuygensING.
the class ChangeLog method getProvenanceChanges.
protected Stream<Change> getProvenanceChanges(DataSet dataSet, Graph graph, String[] subjects, CustomProvenance provenance, Map<String, JsonNode> values) {
TypeNameStore typeNameStore = dataSet.getTypeNameStore();
Stream<Change> customProv = provenance.getFields().stream().filter(field -> field.getValueType() != null).flatMap(field -> {
String graphQlPred = typeNameStore.makeGraphQlnameForPredicate(field.getUri(), Direction.OUT, field.isList());
return Stream.of(subjects).map(subject -> new Change(graph, subject, field.getUri(), getValues(dataSet, values.get(graphQlPred)), Stream.empty()));
});
Stream<Change> customProvNested = provenance.getFields().stream().filter(field -> field.getObject() != null).flatMap(field -> {
String graphQlPred = typeNameStore.makeGraphQlnameForPredicate(field.getUri(), Direction.OUT, field.isList());
JsonNode objectValues = values.get(graphQlPred);
if (objectValues.isArray()) {
Spliterator<JsonNode> spliterator = Spliterators.spliteratorUnknownSize(objectValues.iterator(), Spliterator.ORDERED);
return StreamSupport.stream(spliterator, false).flatMap(newObjectValues -> getChangesForProvObject(dataSet, newObjectValues, graph, subjects, field));
}
return getChangesForProvObject(dataSet, objectValues, graph, subjects, field);
});
return Stream.concat(customProv, customProvNested);
}
use of java.util.Spliterator in project jnosql-diana by eclipse.
the class SettingsConverter method success.
@Override
public Settings success(String value) {
Config config = BeanManagers.getInstance(Config.class);
final Spliterator<String> spliterator = config.getPropertyNames().spliterator();
final String settingsPrefix = getSettingsPrefix(value);
final Map<String, Object> settings = stream(spliterator, false).filter(isSettings(settingsPrefix)).distinct().collect(toMap(s -> s.replace(value + ".settings.", ""), s -> config.getValue(s, String.class)));
return Settings.of(settings);
}
use of java.util.Spliterator in project nexus-public by sonatype.
the class DatastoreMetadataRebuilderTest method infiniteContinuation.
private Continuation infiniteContinuation(Object returnItem) {
Continuation continuation = mock(Continuation.class);
Iterator iterator = mock(Iterator.class);
Spliterator spliterator = mock(Spliterator.class);
when(continuation.spliterator()).thenReturn(spliterator);
when(continuation.iterator()).thenReturn(iterator);
when(iterator.hasNext()).thenReturn(true);
when(iterator.next()).thenReturn(returnItem);
return continuation;
}
Aggregations