Skip to content

Commit e6b3526

Browse files
authored
Merge pull request #531 from firemaples/misc/fix-removeLast
Remove usage of `removeLast()`
2 parents 1505397 + 6242337 commit e6b3526

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

main/src/main/java/tw/firemaples/onscreenocr/utils/WordBoundary.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ object WordBoundary {
1616
// Skip punctuations and blanks
1717
} else {
1818
if (boundaries.size >= 2 && boundaries.last().word.isDash()) {
19-
val sb = StringBuilder(boundaries.removeLast().word)
20-
val lastWord = boundaries.removeLast()
19+
val sb = StringBuilder(boundaries.removeAt(boundaries.lastIndex).word)
20+
val lastWord = boundaries.removeAt(boundaries.lastIndex)
2121
sb.insert(0, lastWord.word)
2222
sb.append(word)
2323
boundaries.add(Boundary(sb.toString(), lastWord.start, end))
2424
} else {
2525
if (boundaries.isNotEmpty() && boundaries.last().word.isDash()) {
26-
boundaries.removeLast()
26+
boundaries.removeAt(boundaries.lastIndex)
2727
}
2828
if (word.isDash() && previousWord?.isBlank() == true) {
2929
// Skip dash following blank pattern. " -"

0 commit comments

Comments
 (0)