From c02a27ebd2f5a93f87825fa44d1fe0e56e69634a Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Sat, 11 Mar 2023 00:35:40 -0500 Subject: android: Convert BiMap to Kotlin --- .../main/java/org/yuzu/yuzu_emu/utils/BiMap.java | 22 ---------------------- .../src/main/java/org/yuzu/yuzu_emu/utils/BiMap.kt | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 22 deletions(-) delete mode 100644 src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/BiMap.java create mode 100644 src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/BiMap.kt (limited to 'src/android') diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/BiMap.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/BiMap.java deleted file mode 100644 index eaf25fa43..000000000 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/BiMap.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.yuzu.yuzu_emu.utils; - -import java.util.HashMap; -import java.util.Map; - -public class BiMap { - private Map forward = new HashMap(); - private Map backward = new HashMap(); - - public synchronized void add(K key, V value) { - forward.put(key, value); - backward.put(value, key); - } - - public synchronized V getForward(K key) { - return forward.get(key); - } - - public synchronized K getBackward(V key) { - return backward.get(key); - } -} diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/BiMap.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/BiMap.kt new file mode 100644 index 000000000..9f11454bc --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/BiMap.kt @@ -0,0 +1,22 @@ +package org.yuzu.yuzu_emu.utils + +class BiMap { + private val forward: MutableMap = HashMap() + private val backward: MutableMap = HashMap() + + @Synchronized + fun add(key: K, value: V) { + forward[key] = value + backward[value] = key + } + + @Synchronized + fun getForward(key: K): V? { + return forward[key] + } + + @Synchronized + fun getBackward(key: V): K? { + return backward[key] + } +} -- cgit v1.2.3