> For the complete documentation index, see [llms.txt](https://bernardo.gitbook.io/development-docs-java/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bernardo.gitbook.io/development-docs-java/generics/general.md).

# General

Generics allow templating classes to specify types.

This is a list without generics:

```java
List list;
String s;

list = new ArrayList();

list.add("hello");

s = (String) list.get(0);
```

This is the same list, specifying it contains Strings:

```java
List<String> list;
String s;

list = new ArrayList<>();

list.add("hello");

s = list.get(0); // no casting
```

## More Information

* [Generics](https://docs.oracle.com/javase/tutorial/java/generics/index.html)
