aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/app/src/main/java/com/wireguard/android/util/Keyed.java
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2018-01-06 03:56:52 -0600
committerSamuel Holland <samuel@sholland.org>2018-01-06 04:09:30 -0600
commite24654ce7ceaa9a319421b420ea1a97c1b6058e4 (patch)
tree3fe6d48f5de73750e5745d06517b225c032e0482 /app/src/main/java/com/wireguard/android/util/Keyed.java
parentTunnelManager: Clear primary tunnel when it's removed (diff)
downloadwireguard-android-e24654ce7ceaa9a319421b420ea1a97c1b6058e4.tar.xz
wireguard-android-e24654ce7ceaa9a319421b420ea1a97c1b6058e4.zip
util: Add a keyed list class and a sorted variant
This is inspired by C#'s KeyedCollection. The sorted variant removes the need for an observable SortedMap. Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'app/src/main/java/com/wireguard/android/util/Keyed.java')
-rw-r--r--app/src/main/java/com/wireguard/android/util/Keyed.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/src/main/java/com/wireguard/android/util/Keyed.java b/app/src/main/java/com/wireguard/android/util/Keyed.java
new file mode 100644
index 00000000..d79fdb97
--- /dev/null
+++ b/app/src/main/java/com/wireguard/android/util/Keyed.java
@@ -0,0 +1,9 @@
+package com.wireguard.android.util;
+
+/**
+ * Interface for objects that have a identifying key of the given type.
+ */
+
+public interface Keyed<K> {
+ K getKey();
+}