org.eclipse.rdf4j.model.util

## Class ModelCollector

- java.lang.Object
- - org.eclipse.rdf4j.model.util.ModelCollector

- All Implemented Interfaces:
    java.util.stream.Collector<Statement,Model,Model>

      public class ModelCollector
      extends Object
      implements java.util.stream.Collector<Statement,Model,Model>

  Collects a stream of Statements into a Model. By default a `LinkedHashModel` will be returned.
  Author:
    Bart Hanssens

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface java.util.stream.Collector

      `java.util.stream.Collector.Characteristics`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ModelCollector()` Constructor
    `ModelCollector(ModelFactory factory)` Constructor

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.function.BiConsumer<Model,Statement>` | `accumulator()`
    `Set<java.util.stream.Collector.Characteristics>` | `characteristics()`
    `java.util.function.BinaryOperator<Model>` | `combiner()`
    `java.util.function.Function<Model,Model>` | `finisher()`
    `java.util.function.Supplier<Model>` | `supplier()`
    `static ModelCollector` | `toModel()` Convenience method to obtain a ModelCollector.
    `static ModelCollector` | `toTreeModel()` Convenience method to obtain a ModelCollector, which will return a TreeModel.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.stream.Collector

      `of, of`

- - ### Constructor Detail

    - #### ModelCollector

          public ModelCollector()

      Constructor

    - #### ModelCollector

          public ModelCollector(ModelFactory factory)

      Constructor
      Parameters:
        `factory` -

  - ### Method Detail

    - #### toModel

          public static ModelCollector toModel()

      Convenience method to obtain a ModelCollector.
      Returns:
        a ModelCollector

    - #### toTreeModel

          public static ModelCollector toTreeModel()

      Convenience method to obtain a ModelCollector, which will return a TreeModel.
      Returns:
        a ModelCollector

    - #### supplier

          public java.util.function.Supplier<Model> supplier()

      Specified by:
        `supplier` in interface `java.util.stream.Collector<Statement,Model,Model>`

    - #### accumulator

          public java.util.function.BiConsumer<Model,Statement> accumulator()

      Specified by:
        `accumulator` in interface `java.util.stream.Collector<Statement,Model,Model>`

    - #### combiner

          public java.util.function.BinaryOperator<Model> combiner()

      Specified by:
        `combiner` in interface `java.util.stream.Collector<Statement,Model,Model>`

    - #### finisher

          public java.util.function.Function<Model,Model> finisher()

      Specified by:
        `finisher` in interface `java.util.stream.Collector<Statement,Model,Model>`

    - #### characteristics

          public Set<java.util.stream.Collector.Characteristics> characteristics()

      Specified by:
        `characteristics` in interface `java.util.stream.Collector<Statement,Model,Model>`

Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.