Skip to content

Add FancyPicture class#18

Open
stop-upiter wants to merge 5 commits intovk-education:masterfrom
stop-upiter:master
Open

Add FancyPicture class#18
stop-upiter wants to merge 5 commits intovk-education:masterfrom
stop-upiter:master

Conversation

@stop-upiter
Copy link
Contributor

No description provided.

@stop-upiter stop-upiter requested a review from 0xera as a code owner May 26, 2021 21:22

// todo id generator

var image: Bitmap = pair.first
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data class FancyPicture(
    val id: String,
    val title: String,
    val image: Bitmap,
    val colors: List<List<String>>
)

Этот класс хранит данные, попробуй сделать дата классом, Array заменить на List. String? заменить на String, Избегайте nullable по возможности.

init {
    width = colors.size
    length = colors[0].size
}

А если массив пустой? тут init отвалится с outofboundexeption. лучше вычислять length rows/columns там где это необходимо, сделав проверку на наличие чего-либо в этом списке.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants