JONKI
JONKI

Reputation: 595

How do you replace all classes in a project with another class?

Migrates in a project from the Date class to the Instant class, which is recommended for Java 8. The Date class I have used in the project 80 times. enter image description here

Is there any way, all use of the Date class type to be replaced with the Instant class type?

Change the Date class to Instant

Change new Date to Instant.now()

Change import java.util.Date to java.date.Instant

I use IntellIJ. I am looking for a way that I do not have to do it manually 80 times. Is there an automatic way for a substitute?

Upvotes: 0

Views: 393

Answers (1)

CrazyCoder
CrazyCoder

Reputation: 401897

IntelliJ IDEA provides the Migrate refactoring.

The Migrate refactoring allows you to easily switch between the old packages and classes used in your project and the new ones.

Upvotes: 2

Related Questions