0% found this document useful (0 votes)
2 views2 pages

Java Spring Shape Implementation

The document defines an interface 'Shape' and two implementing classes, 'Circle' and 'Square', both annotated as Spring components with specific qualifiers. It also includes a class 'MyClass' that autowires a 'Shape' instance using the 'square' qualifier. Additionally, there is a snippet demonstrating the use of a TreeMap and filtering its entries based on keys, although the names list is not initialized in the provided code.

Uploaded by

souparna7781
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Java Spring Shape Implementation

The document defines an interface 'Shape' and two implementing classes, 'Circle' and 'Square', both annotated as Spring components with specific qualifiers. It also includes a class 'MyClass' that autowires a 'Shape' instance using the 'square' qualifier. Additionally, there is a snippet demonstrating the use of a TreeMap and filtering its entries based on keys, although the names list is not initialized in the provided code.

Uploaded by

souparna7781
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

interface Shape {

@Component
@Qualifier("circle")
class Circle implements Shape{

@Component
@Qualifier("square")
class Square implements Shape{

class MyClass{

@Autowired
@Qualifier("square")
Shape shape;

TreeMap<Integer,String> hMap = new TreeMap<>();

List<String> names;
[Link]().filter((key,value)->key%2!=0).forEach((key,value)->
[Link](value));

//names

Comparator

You might also like