Sunday, 30 July 2023

PlantUML: Define generics in a class

Bracket < and > used to define generics.

 

generics.txt

@startuml
	 
	class List<T> {
		int size()
		T ele()
	}

	interface Comparator<T> {
		+ boolean equals(Object obj)
	} 

	class Employee{

	}

	class Set<? extends Employee> {
		int size()
	}

	Set *- Employee


@enduml

 

Above snippet generate below diagram.

 


  

Previous                                                    Next                                                    Home

No comments:

Post a Comment