Package org.eclipse.rdf4j.model.util

## Class ModelCollector

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

- All Implemented Interfaces:
    `Collector<Statement,​Model,​Model>`

      public class ModelCollector
      extends Object
      implements 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

      `Collector.Characteristics`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ModelCollector()` | Constructor
    `ModelCollector​(ModelFactory factory)` | Constructor

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `BiConsumer<Model,​Statement>` | `accumulator()` |
    `Set<Collector.Characteristics>` | `characteristics()` |
    `BinaryOperator<Model>` | `combiner()` |
    `Function<Model,​Model>` | `finisher()` |
    `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`

- - ### 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 Supplier<Model> supplier()

      Specified by:
        `supplier` in interface `Collector<Statement,​Model,​Model>`

    - #### accumulator

          public BiConsumer<Model,​Statement> accumulator()

      Specified by:
        `accumulator` in interface `Collector<Statement,​Model,​Model>`

    - #### combiner

          public BinaryOperator<Model> combiner()

      Specified by:
        `combiner` in interface `Collector<Statement,​Model,​Model>`

    - #### finisher

          public Function<Model,​Model> finisher()

      Specified by:
        `finisher` in interface `Collector<Statement,​Model,​Model>`

    - #### characteristics

          public Set<Collector.Characteristics> characteristics()

      Specified by:
        `characteristics` in interface `Collector<Statement,​Model,​Model>`