Skip to content

What is a parameterized or generic type? #6

@ThomsonTang

Description

@ThomsonTang

A generic type is a type with formal type parameters. A parameterized type is an instantiation of a generic type which actual arguments.

A generic type is a reference type that has one or more type parameters. These type parameters are later replaced by type arguments when the generic type is instantiated ( or declared).

  • Example of a generic type:
interface Collection<E> {
    public void add(E e);
    public Iterator<E> iterate();
}
  • Example of a parameterized type:
Collection<String> collection = new LinkedList<String>();

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions