Skip to content

Copy method #229

Closed
Closed
@enciyo

Description

@enciyo

Hi, Sometimes, I need copy method like data class copy. I couldn't find any copy method. So, I created a new method for copy. But, I would expect this to be in the standard library.

I'm curious about your thoughts on this subject.

fun LocalTime.copy(
    hour: Int? = null,
    minute: Int? = null,
    second: Int? = null,
    nanoSeconds: Int? = null,
) = LocalTime(
    hour = hour ?: this.hour,
    minute = minute ?: this.minute,
    second = second ?: this.second,
    nanosecond = nanoSeconds ?: this.nanosecond
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions