# Polymorphism without inheritence
In programming languages and type theory, polymorphism is the provision of a single interface to entities of different types or the use of a single symbol to represent multiple different types.
Most common way of achieving polymorphism is through inheritence/Subtyping. Besides for this there are other ways to achieve polymorphism. The most commonly recognized of which is parametric polymorphism.
Using parametric polymorphism, a function or a data type can be written generically so that it can handle values identically without depending on their type. Such functions and data types are called generic functions and generic datatypes respectively and form the basis of generic programming.
For example, in java, this feature is supported by the name of 'generics'. It is used in the standard Java library collections.
For example, Collections.sort is declared as:
public static <T extends Comparable<? super T>> void sort(List<T> list)
It can take a list of objects of type T that is comparable to other T's and sort the list, without knowing about what type T actually is.
It is different from inheritence/subtype polymorphism: subtype polymorphism is illustrate by the fact that sort can work on any kind of List :ArrayList, LinkedList, etc.