Declaring generic List interface rather than ArrayList

This commit is contained in:
Dave
2015-06-28 22:37:07 +02:00
parent a40d5e9738
commit 7f641d31e3
2 changed files with 5 additions and 4 deletions

View File

@@ -19,13 +19,14 @@ package nodash.core.spheres;
import java.security.PublicKey;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import nodash.models.NoByteSet;
import nodash.models.NoUser;
public final class NoByteSetSphere {
private static final ArrayList<NoByteSet> EMPTY_BYTESET_LIST = new ArrayList<NoByteSet>(0);
private static final List<NoByteSet> EMPTY_BYTESET_LIST = new ArrayList<NoByteSet>(0);
private static ConcurrentHashMap<PublicKey, ArrayList<NoByteSet>> byteSets =
new ConcurrentHashMap<PublicKey, ArrayList<NoByteSet>>();
@@ -37,14 +38,14 @@ public final class NoByteSetSphere {
NoByteSetSphere.byteSets.get(publicKey).add(byteSet);
}
public static void addList(ArrayList<NoByteSet> byteSetList, PublicKey publicKey) {
public static void addList(List<NoByteSet> byteSetList, PublicKey publicKey) {
if (!NoByteSetSphere.byteSets.containsKey(publicKey)) {
NoByteSetSphere.byteSets.put(publicKey, new ArrayList<NoByteSet>());
}
NoByteSetSphere.byteSets.get(publicKey).addAll(byteSetList);
}
public static ArrayList<NoByteSet> consume(NoUser user) {
public static List<NoByteSet> consume(NoUser user) {
if (NoByteSetSphere.byteSets.containsKey(user.getRSAPublicKey())) {
ArrayList<NoByteSet> result = NoByteSetSphere.byteSets.get(user.getRSAPublicKey());
NoByteSetSphere.byteSets.remove(user.getRSAPublicKey());