diff options
author | Samuel Holland <samuel@sholland.org> | 2018-01-06 23:44:34 -0600 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2018-01-06 23:44:34 -0600 |
commit | 536c6958fc1895638721befd0b70a3ff082bcc22 (patch) | |
tree | 26c21f027c3e1687bde384a03dd4ae1fd4664fd2 /app/src/main/java/com/wireguard/android/util/SortedKeyedList.java | |
parent | Keyed...: Rename all the things (diff) | |
download | wireguard-android-536c6958fc1895638721befd0b70a3ff082bcc22.tar.xz wireguard-android-536c6958fc1895638721befd0b70a3ff082bcc22.zip |
SortedKeyedList...: Support arbitrary comparators
Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'app/src/main/java/com/wireguard/android/util/SortedKeyedList.java')
-rw-r--r-- | app/src/main/java/com/wireguard/android/util/SortedKeyedList.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/src/main/java/com/wireguard/android/util/SortedKeyedList.java b/app/src/main/java/com/wireguard/android/util/SortedKeyedList.java new file mode 100644 index 00000000..b164b99d --- /dev/null +++ b/app/src/main/java/com/wireguard/android/util/SortedKeyedList.java @@ -0,0 +1,22 @@ +package com.wireguard.android.util; + +import java.util.Collection; +import java.util.Comparator; +import java.util.Set; + +/** + * A keyed list where all elements are sorted by the comparator returned by {@code comparator()} + * applied to their keys. + */ + +public interface SortedKeyedList<K, E extends Keyed<? extends K>> extends KeyedList<K, E> { + Comparator<? super K> comparator(); + + K firstKey(); + + Set<K> keySet(); + + K lastKey(); + + Collection<E> values(); +} |