Replace ArrayList by mutableList

This commit is contained in:
J-Jamet
2021-07-02 19:25:30 +02:00
parent e95e7218f6
commit 8703684740
2 changed files with 21 additions and 19 deletions

View File

@@ -122,8 +122,8 @@ class Template : Parcelable {
val STANDARD: Template
get() {
val sections = ArrayList<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply {
val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(USERNAME_ATTRIBUTE)
add(PASSWORD_ATTRIBUTE)
add(URL_ATTRIBUTE)
@@ -140,8 +140,8 @@ class Template : Parcelable {
val CREATION: Template
get() {
val sections = ArrayList<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply {
val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
// Dynamic part
})
sections.add(mainSection)

View File

@@ -3,7 +3,6 @@ package com.kunzisoft.keepass.database.element.template
import com.kunzisoft.keepass.database.element.icon.IconImage
import com.kunzisoft.keepass.database.element.icon.IconImageStandard
import java.util.*
import kotlin.collections.ArrayList
class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
@@ -30,8 +29,8 @@ class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
val email: Template
get() {
val sections = ArrayList<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply {
val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(emailAddressAttribute)
add(urlAttribute)
add(passwordAttribute)
@@ -46,8 +45,8 @@ class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
val wifi: Template
get() {
val sections = ArrayList<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply {
val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(ssidAttribute)
add(passwordAttribute)
})
@@ -61,8 +60,8 @@ class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
val notes: Template
get() {
val sections = ArrayList<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply {
val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(notesPlainAttribute)
})
sections.add(mainSection)
@@ -75,8 +74,8 @@ class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
val idCard: Template
get() {
val sections = ArrayList<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply {
val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(numberAttribute)
add(nameAttribute)
add(placeOfIssueAttribute)
@@ -93,8 +92,8 @@ class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
val creditCard: Template
get() {
val sections = ArrayList<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply {
val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(numberAttribute)
add(cvvAttribute)
add(pinAttribute)
@@ -111,17 +110,20 @@ class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
val bank: Template
get() {
val sections = ArrayList<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply {
val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(nameAttribute)
add(urlAttribute)
add(usernameAttribute)
add(passwordAttribute)
})
val ibanSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(holderAttribute)
add(bicAttribute)
add(ibanAttribute)
})
sections.add(mainSection)
sections.add(ibanSection)
return Template(
UUID.randomUUID(),
TemplateField.LABEL_BANK,
@@ -131,8 +133,8 @@ class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
val cryptocurrency: Template
get() {
val sections = ArrayList<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply {
val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(tokenAttribute)
add(publicKeyAttribute)
add(privateKeyAttribute)