Intellij Idea And Android Studio plugin for generating compact equals method for Kotlin classes
- Click alt+insert (Generate menu)
- Choose
Kenerator
- Choose
Equals
orHashcode
override fun equals(other: Any?): Boolean = other is BannerFace
&& super.equals(other)
&& name == other.name
&& image == other.image
override fun hashCode(): Int = Objects.hash(
super.hashCode(),
name,
image
)
- Will not care for existing
equals
andhashcode
methods. You have to delete them yourself. - Will not import used classes automatically.
- You have to do the reformatting afterwards yourself.
- Will not compare arrays with
Arrays.equals()
method. - Tested only on standard Kotlin classes. May have edge-cases.
-
Using IDE built-in plugin system:
Preferences > Plugins > Marketplace > Search for "Kenerator" > Install Plugin
-
Manually:
Download the latest release and install it manually using Preferences > Plugins > ⚙️ > Install plugin from disk...
Plugin based on the IntelliJ Platform Plugin Template.