diff options
author | Samuel Holland <samuel@sholland.org> | 2018-06-19 00:47:48 -0500 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2018-06-19 21:59:44 -0500 |
commit | 9be51f460c88e1fd4fab58504e053532d51fdad1 (patch) | |
tree | 3f322d5255209c3d14d50eec30f17e60c3e46101 /app/src/main/java/com/wireguard/util/KeyedList.java | |
parent | crypto: Slightly Java-ify the Curve25519 implementation (diff) | |
download | wireguard-android-9be51f460c88e1fd4fab58504e053532d51fdad1.tar.xz wireguard-android-9be51f460c88e1fd4fab58504e053532d51fdad1.zip |
util: Extract non-Android utility interfaces
As part of a refactoring that will likely introduce more custom
collection classes, move the non-Android-specific parts outside the
com.wireguard.android package.
Diffstat (limited to 'app/src/main/java/com/wireguard/util/KeyedList.java')
-rw-r--r-- | app/src/main/java/com/wireguard/util/KeyedList.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/app/src/main/java/com/wireguard/util/KeyedList.java b/app/src/main/java/com/wireguard/util/KeyedList.java new file mode 100644 index 00000000..1478dc19 --- /dev/null +++ b/app/src/main/java/com/wireguard/util/KeyedList.java @@ -0,0 +1,28 @@ +/* + * Copyright © 2018 Samuel Holland <samuel@sholland.org> + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +package com.wireguard.util; + +import java.util.Collection; +import java.util.List; + +/** + * A list containing elements that can be looked up by key. A {@code KeyedList} cannot contain + * {@code null} elements. + */ + +public interface KeyedList<K, E extends Keyed<? extends K>> extends List<E> { + boolean containsAllKeys(Collection<K> keys); + + boolean containsKey(K key); + + E get(K key); + + E getLast(K key); + + int indexOfKey(K key); + + int lastIndexOfKey(K key); +} |