diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index e8c287a..413be3c 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -10,10 +10,8 @@
-
-
diff --git a/gradle.properties b/gradle.properties
index 68da322..4dbb90c 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -4,7 +4,7 @@ kotlin.code.style=official
specifyKotlinAsDependency=false
projectGroup=ru.dbotthepony.kommons
-projectVersion=2.15.0
+projectVersion=2.15.1
guavaDepVersion=33.0.0
gsonDepVersion=2.8.9
diff --git a/src/main/kotlin/ru/dbotthepony/kommons/arrays/Object2DArray.kt b/src/main/kotlin/ru/dbotthepony/kommons/arrays/Object2DArray.kt
index 6078411..0db267a 100644
--- a/src/main/kotlin/ru/dbotthepony/kommons/arrays/Object2DArray.kt
+++ b/src/main/kotlin/ru/dbotthepony/kommons/arrays/Object2DArray.kt
@@ -89,6 +89,27 @@ class Object2DArray private constructor(
return mem[column * rows + row] as T
}
+ fun getOrNull(column: Int, row: Int): T? {
+ if (column !in 0 until columns || row !in 0 until rows)
+ return null
+
+ return mem[column * rows + row] as T
+ }
+
+ fun getOrElse(column: Int, row: Int, orElse: T): T {
+ if (column !in 0 until columns || row !in 0 until rows)
+ return orElse
+
+ return mem[column * rows + row] as T
+ }
+
+ fun getOrElse(column: Int, row: Int, orElse: () -> T): T {
+ if (column !in 0 until columns || row !in 0 until rows)
+ return orElse.invoke()
+
+ return mem[column * rows + row] as T
+ }
+
operator fun set(column: Int, row: Int, value: T) {
if (column !in 0 until columns || row !in 0 until rows)
throw IndexOutOfBoundsException("Matrix index out of bounds: $column x $row, while this array has dimensions of $columns x $rows")