Package org.apache.commons.collections4

# Interface Factory<T>

Type Parameters:
  `T` - The type of results supplied by this supplier.

All Superinterfaces:
  `Supplier<T>`

All Known Implementing Classes:
  `ConstantFactory`, `ExceptionFactory`, `InstantiateFactory`

public interface Factory<T> extends Supplier<T>
Defines a functor interface implemented by classes that create objects.

A `Factory` creates an object without using an input parameter. If an input parameter is required, then `Transformer` is more appropriate.

Standard implementations of common factories are provided by `FactoryUtils`. These include factories that return a constant, a copy of a prototype or a new instance.

Since:
  2.1 This will be deprecated in 5.0 in favor of `Supplier`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `T`
  `create()`
  Create a new object.
  `default T`
  `get()`

- ## Method Details

  - ### create

    T create()
    Create a new object.
    Returns:
      A new object
    Throws:
      `FunctorException` - (runtime) if the factory cannot create an object.

  - ### get

    default T get()
    Specified by:
      `get` in interface `Supplier<T>`