Showing posts with label Generics. Show all posts
Showing posts with label Generics. Show all posts

Wednesday, August 12, 2020

Raw type Generics in Java - Working Examples

1. Raw type Generics in Java 


Raw Type is part of Java Generics. Raw Type is If any generic class reference or instance is created without mentioning the proper Type for the Generic type. Reference indicates to Class or Interface.

Generics in Java

Generics naming conventions and rules

Generics main aim to provide tighter type checks at compile time.

Raw type in Java Generics with Examples

Monday, April 8, 2019

Generics in Java

Generics in Java

Generics concept is introduced in Java 5. we will discuss

a) What are Generics?
b) What will happen if do not have Generics introduced?
c) Why do use Generics?
d) Where Generics are used in Java API?

We will first see case b.


Generics in Java

Wednesday, October 25, 2017

Best Ways to Java Generic Naming Convention, Rules, Examples

In this post, We will learn what are the naming conventions rules for Generic type parameters. Many people might have seen that Generic types are heavily used in Java Collection api such as ArrayList, HashSet, HashMap.

Best Ways to Java Generic Naming Convention, Rules, Examples

Generics types are should be enclosed in Diamond operator.

Wednesday, October 18, 2017

Java Type Inference in Generics

Type Inference in Generic

In Java 7, Type Inference is introduced in generics declaration which is used to reduce the coding as well to minimize the compile errors.

Made compiler smart enough to infer the type of generic instance. This is done by using "<>" operator and it is called as Diamond Operator. Not required to mention the type in between diamond operator and can be replaced declaring the type as left blank.

Java Type Inference in Generics