Skip to content

Files

Latest commit

 

History

History
28 lines (18 loc) · 450 Bytes

ObjectLiteralToLambda.md

File metadata and controls

28 lines (18 loc) · 450 Bytes

Pattern: Missing use of anonymous object as lambda

Issue: -

Description

An anonymous object that does nothing other than the implementation of a single method can be used as a lambda.

Example of incorrect code:

object : Foo {
    override fun bar() {
    }
}

Example of correct code:

Foo {
}

Further Reading