algorithm: Use ConcurrentHashMap instead of HashMap

Signed-off-by: Paul Schaub <vanitasvitae@fsfe.org>
This commit is contained in:
Paul Schaub 2020-01-09 20:49:12 +01:00
parent 2c816dd84c
commit 8780d5a7b0
5 changed files with 11 additions and 11 deletions

View File

@ -15,8 +15,8 @@
*/
package org.pgpainless.algorithm;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.bouncycastle.bcpg.CompressionAlgorithmTags;
@ -28,7 +28,7 @@ public enum CompressionAlgorithm {
BZIP2 (CompressionAlgorithmTags.BZIP2),
;
private static final Map<Integer, CompressionAlgorithm> MAP = new HashMap<>();
private static final Map<Integer, CompressionAlgorithm> MAP = new ConcurrentHashMap<>();
static {
for (CompressionAlgorithm c : CompressionAlgorithm.values()) {

View File

@ -15,8 +15,8 @@
*/
package org.pgpainless.algorithm;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.bouncycastle.bcpg.sig.Features;
@ -31,7 +31,7 @@ public enum Feature {
MODIFICATION_DETECTION(Features.FEATURE_MODIFICATION_DETECTION),
;
private static final Map<Byte, Feature> MAP = new HashMap<>();
private static final Map<Byte, Feature> MAP = new ConcurrentHashMap<>();
static {
for (Feature f : Feature.values()) {

View File

@ -15,8 +15,8 @@
*/
package org.pgpainless.algorithm;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.bouncycastle.bcpg.HashAlgorithmTags;
@ -34,8 +34,8 @@ public enum HashAlgorithm {
SHA512 (HashAlgorithmTags.SHA512),
SHA224 (HashAlgorithmTags.SHA224),
;
// Coincidence? I don't this so...
private static final Map<Integer, HashAlgorithm> MAP = new HashMap<>();
private static final Map<Integer, HashAlgorithm> MAP = new ConcurrentHashMap<>();
static {
for (HashAlgorithm h : HashAlgorithm.values()) {

View File

@ -15,8 +15,8 @@
*/
package org.pgpainless.algorithm;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.bouncycastle.bcpg.PublicKeyAlgorithmTags;
@ -38,7 +38,7 @@ public enum PublicKeyAlgorithm {
DIFFIE_HELLMAN (PublicKeyAlgorithmTags.DIFFIE_HELLMAN),
;
private static final Map<Integer, PublicKeyAlgorithm> MAP = new HashMap<>();
private static final Map<Integer, PublicKeyAlgorithm> MAP = new ConcurrentHashMap<>();
static {
for (PublicKeyAlgorithm p : PublicKeyAlgorithm.values()) {

View File

@ -15,8 +15,8 @@
*/
package org.pgpainless.algorithm;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.bouncycastle.bcpg.SymmetricKeyAlgorithmTags;
@ -42,7 +42,7 @@ public enum SymmetricKeyAlgorithm {
CAMELLIA_256 (SymmetricKeyAlgorithmTags.CAMELLIA_256),
;
private static final Map<Integer, SymmetricKeyAlgorithm> MAP = new HashMap<>();
private static final Map<Integer, SymmetricKeyAlgorithm> MAP = new ConcurrentHashMap<>();
static {
for (SymmetricKeyAlgorithm s : SymmetricKeyAlgorithm.values()) {