Skip to content

Commit

Permalink
refactor (enum): add infix function and for enum set
Browse files Browse the repository at this point in the history
  • Loading branch information
xeewii committed Aug 20, 2024
1 parent b3dd76d commit 6e4dfba
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ object EnumUtils {
inline fun <reified T : Enum<T>> getEnumsString(enums: EnumSet<T>): String {
return enums.joinToString(",") { it.toString() }
}

infix fun<T: Enum<T>> EnumSet<T>.and(other: T): EnumSet<T> {
this.add(other)
return this
}
}

0 comments on commit 6e4dfba

Please sign in to comment.