Selenium For Beginners

Share this post

User's avatar
Selenium For Beginners
Use records instead of maps
Java

Use records instead of maps

Alex Siminiuc's avatar
Alex Siminiuc
Apr 16, 2024
∙ Paid

Share this post

User's avatar
Selenium For Beginners
Use records instead of maps
Share

A previous post discusses how a map should be replaced with an object of a new class so that our code is written in an object-oriented way.

A quick look at this new class shows that it is quite big.

It includes

  • constructor for saving all constructor parameters in class fields

  • get methods, one for each class field; no set methods though

  • equals() method

  • hashCode() method

  • toString() method

That’s a lot of code to be added to your project.

Eclipse can generate all of it automatically so you do not have to type it.

But if you need to add additional parameters to the constructor, remove/change existing ones, you need to make changes manually everywhere.

Is there a better option?

Keep reading with a 7-day free trial

Subscribe to Selenium For Beginners to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Alex Siminiuc
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share