Declaring generic List interface rather than ArrayList
This commit is contained in:
@@ -19,13 +19,14 @@ package nodash.core.spheres;
|
|||||||
|
|
||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import nodash.models.NoByteSet;
|
import nodash.models.NoByteSet;
|
||||||
import nodash.models.NoUser;
|
import nodash.models.NoUser;
|
||||||
|
|
||||||
public final class NoByteSetSphere {
|
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 =
|
private static ConcurrentHashMap<PublicKey, ArrayList<NoByteSet>> byteSets =
|
||||||
new ConcurrentHashMap<PublicKey, ArrayList<NoByteSet>>();
|
new ConcurrentHashMap<PublicKey, ArrayList<NoByteSet>>();
|
||||||
@@ -37,14 +38,14 @@ public final class NoByteSetSphere {
|
|||||||
NoByteSetSphere.byteSets.get(publicKey).add(byteSet);
|
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)) {
|
if (!NoByteSetSphere.byteSets.containsKey(publicKey)) {
|
||||||
NoByteSetSphere.byteSets.put(publicKey, new ArrayList<NoByteSet>());
|
NoByteSetSphere.byteSets.put(publicKey, new ArrayList<NoByteSet>());
|
||||||
}
|
}
|
||||||
NoByteSetSphere.byteSets.get(publicKey).addAll(byteSetList);
|
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())) {
|
if (NoByteSetSphere.byteSets.containsKey(user.getRSAPublicKey())) {
|
||||||
ArrayList<NoByteSet> result = NoByteSetSphere.byteSets.get(user.getRSAPublicKey());
|
ArrayList<NoByteSet> result = NoByteSetSphere.byteSets.get(user.getRSAPublicKey());
|
||||||
NoByteSetSphere.byteSets.remove(user.getRSAPublicKey());
|
NoByteSetSphere.byteSets.remove(user.getRSAPublicKey());
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public final class NoSession implements Serializable {
|
|||||||
private final long expiry;
|
private final long expiry;
|
||||||
private boolean newUserSession;
|
private boolean newUserSession;
|
||||||
|
|
||||||
public ArrayList<NoByteSet> incoming;
|
public List<NoByteSet> incoming;
|
||||||
public NoUser current;
|
public NoUser current;
|
||||||
public UUID uuid;
|
public UUID uuid;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user