Skip to content

Commit b182121

Browse files
committed
Fix sonar issue S2293 Replace the type specification in this constructor call with the diamond operator ('<>')
1 parent 266d835 commit b182121

324 files changed

Lines changed: 1102 additions & 1102 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/CommandPrompt.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ public static void run(String[] args) throws Exception{
9595
/*
9696
* Parse input arguments
9797
*/
98-
List<Character> propertyList = new ArrayList<Character>();
99-
List<Character> specificList = new ArrayList<Character>();
98+
List<Character> propertyList = new ArrayList<>();
99+
List<Character> specificList = new ArrayList<>();
100100
String inputLocation = null;
101101
String outputLocation = null;
102102
String aminoAcidCompositionLocation = null;
@@ -179,14 +179,14 @@ private static LinkedHashMap<String, ProteinSequence> readInputFile(String input
179179
}
180180
LinkedHashMap<String, ProteinSequence> ret;
181181
if ( inputLocation.toLowerCase().contains(".gb")) {
182-
GenbankReader<ProteinSequence, AminoAcidCompound> genbankReader = new GenbankReader<ProteinSequence, AminoAcidCompound>(
182+
GenbankReader<ProteinSequence, AminoAcidCompound> genbankReader = new GenbankReader<>(
183183
inStream, new GenericGenbankHeaderParser<ProteinSequence, AminoAcidCompound>(),
184184
new ProteinSequenceCreator(set));
185185
ret = genbankReader.process();
186186

187187

188188
} else {
189-
FastaReader<ProteinSequence, AminoAcidCompound> fastaReader = new FastaReader<ProteinSequence, AminoAcidCompound>(
189+
FastaReader<ProteinSequence, AminoAcidCompound> fastaReader = new FastaReader<>(
190190
inStream, new GenericFastaHeaderParser<ProteinSequence, AminoAcidCompound>(),
191191
new ProteinSequenceCreator(set));
192192
ret = fastaReader.process();
@@ -214,7 +214,7 @@ private static void printHeader(PrintStream output, List<Character> propertyList
214214
* 9 Composition of the 20 standard amino acid
215215
* 0 Composition of the specific amino acid
216216
*/
217-
List<String> sList = new ArrayList<String>();
217+
List<String> sList = new ArrayList<>();
218218
sList.add("SequenceName");
219219
for(Character c:propertyList){
220220
switch(c){
@@ -277,7 +277,7 @@ private static void compute(PrintStream output, String header, String sequence,
277277
IPeptideProperties pp = new PeptidePropertiesImpl();
278278

279279
int specificCount = 0;
280-
List<Double> dList = new ArrayList<Double>();
280+
List<Double> dList = new ArrayList<>();
281281
for(Character c:propertyList){
282282
switch(c){
283283
case '1':

biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Constraints.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ public class Constraints {
6464
public static AminoAcidCompound Y = aaSet.getCompoundForString("Y");
6565
public static AminoAcidCompound V = aaSet.getCompoundForString("V");
6666

67-
public static Map<AminoAcidCompound, Double> aa2ExtinctionCoefficient = new HashMap<AminoAcidCompound, Double>();
68-
public static Map<AminoAcidCompound, Double> aa2MolecularWeight = new HashMap<AminoAcidCompound, Double>();
69-
public static Map<AminoAcidCompound, Double> aa2Hydrophathicity = new HashMap<AminoAcidCompound, Double>();
70-
public static Map<AminoAcidCompound, Double> aa2PKa = new HashMap<AminoAcidCompound, Double>();
71-
public static Map<String, Double> diAA2Instability = new HashMap<String, Double>();
67+
public static Map<AminoAcidCompound, Double> aa2ExtinctionCoefficient = new HashMap<>();
68+
public static Map<AminoAcidCompound, Double> aa2MolecularWeight = new HashMap<>();
69+
public static Map<AminoAcidCompound, Double> aa2Hydrophathicity = new HashMap<>();
70+
public static Map<AminoAcidCompound, Double> aa2PKa = new HashMap<>();
71+
public static Map<String, Double> diAA2Instability = new HashMap<>();
7272

73-
public static Map<AminoAcidCompound, Double> aa2NTerminalPka = new HashMap<AminoAcidCompound, Double>();
74-
public static Map<AminoAcidCompound, Double> aa2CTerminalPka = new HashMap<AminoAcidCompound, Double>();
73+
public static Map<AminoAcidCompound, Double> aa2NTerminalPka = new HashMap<>();
74+
public static Map<AminoAcidCompound, Double> aa2CTerminalPka = new HashMap<>();
7575

7676
static{
7777
initMolecularWeight();

biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/PeptideProperties.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ public static final Map<AminoAcidCompound, Double> getAAComposition(String seque
532532
*/
533533
public static final Map<String, Double> getAACompositionString(String sequence){
534534
Map<AminoAcidCompound, Double> aa2Composition = getAAComposition(sequence);
535-
Map<String, Double> aaString2Composition = new HashMap<String, Double>();
535+
Map<String, Double> aaString2Composition = new HashMap<>();
536536
aaString2Composition = aa2Composition.keySet().stream() .collect(Collectors.toMap(aaCompound -> aaCompound.getShortName(),aaCompound ->aa2Composition.get(aaCompound)));
537537
return aaString2Composition;
538538
}
@@ -550,7 +550,7 @@ public static final Map<String, Double> getAACompositionString(String sequence){
550550
*/
551551
public static final Map<Character, Double> getAACompositionChar(String sequence){
552552
Map<AminoAcidCompound, Double> aa2Composition = getAAComposition(sequence);
553-
Map<Character, Double> aaChar2Composition = new HashMap<Character, Double>();
553+
Map<Character, Double> aaChar2Composition = new HashMap<>();
554554
for(AminoAcidCompound aaCompound:aa2Composition.keySet()){
555555
aaChar2Composition.put(aaCompound.getShortName().charAt(0), aa2Composition.get(aaCompound));
556556
}

biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/PeptidePropertiesImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ private Map<AminoAcidCompound, Integer> getExtinctAACount(ProteinSequence sequen
210210
}
211211
}
212212
AminoAcidCompoundSet aaSet = new AminoAcidCompoundSet();
213-
Map<AminoAcidCompound, Integer> extinctAA2Count = new HashMap<AminoAcidCompound, Integer>();
213+
Map<AminoAcidCompound, Integer> extinctAA2Count = new HashMap<>();
214214
//Ignore Case is always true
215215
extinctAA2Count.put(aaSet.getCompoundForString("W"), numW + smallW);
216216
extinctAA2Count.put(aaSet.getCompoundForString("C"), (int) (numC + smallC));
@@ -532,7 +532,7 @@ private Map<AminoAcidCompound, Integer> getChargedAACount(ProteinSequence sequen
532532
}
533533
}
534534
AminoAcidCompoundSet aaSet = new AminoAcidCompoundSet();
535-
Map<AminoAcidCompound, Integer> chargedAA2Count = new HashMap<AminoAcidCompound, Integer>();
535+
Map<AminoAcidCompound, Integer> chargedAA2Count = new HashMap<>();
536536
chargedAA2Count.put(aaSet.getCompoundForString("K"), numK);
537537
chargedAA2Count.put(aaSet.getCompoundForString("R"), numR);
538538
chargedAA2Count.put(aaSet.getCompoundForString("H"), numH);
@@ -558,7 +558,7 @@ public double getEnrichment(ProteinSequence sequence, AminoAcidCompound aminoAci
558558
@Override
559559
public Map<AminoAcidCompound, Double> getAAComposition(ProteinSequence sequence) {
560560
int validLength = 0;
561-
Map<AminoAcidCompound, Double> aa2Composition = new HashMap<AminoAcidCompound, Double>();
561+
Map<AminoAcidCompound, Double> aa2Composition = new HashMap<>();
562562
AminoAcidCompoundSet aaSet = new AminoAcidCompoundSet();
563563
for(AminoAcidCompound aa:aaSet.getAllCompounds()){
564564
aa2Composition.put(aa, 0.0);

biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public final static int getNumberOfInvalidChar(String sequence, Set<Character>
106106
* a new sequence with all invalid characters being replaced by '-'.
107107
*/
108108
public final static String cleanSequence(String sequence, Set<Character> cSet){
109-
Set<Character> invalidCharSet = new HashSet<Character>();
109+
Set<Character> invalidCharSet = new HashSet<>();
110110
StringBuilder cleanSeq = new StringBuilder();
111111
if(cSet == null) cSet = PeptideProperties.standardAASet;
112112
for(char c:sequence.toCharArray()){

biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/ProfeatPropertiesImpl.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,43 +125,43 @@ private Convertor getConvertor(ATTRIBUTE attribute) throws Exception{
125125

126126
@Override
127127
public Map<GROUPING, Double> getComposition(ProteinSequence sequence, ATTRIBUTE attribute) throws Exception {
128-
Map<GROUPING, Double> grouping2Composition = new HashMap<GROUPING, Double>();
128+
Map<GROUPING, Double> grouping2Composition = new HashMap<>();
129129
for(GROUPING group:GROUPING.values()) grouping2Composition.put(group, getComposition(sequence, attribute, group));
130130
return grouping2Composition;
131131
}
132132

133133
@Override
134134
public Map<ATTRIBUTE, Map<GROUPING, Double>> getComposition(ProteinSequence sequence) throws Exception {
135-
Map<ATTRIBUTE, Map<GROUPING, Double>> attribute2Grouping2Composition = new HashMap<ATTRIBUTE, Map<GROUPING, Double>>();
135+
Map<ATTRIBUTE, Map<GROUPING, Double>> attribute2Grouping2Composition = new HashMap<>();
136136
for(ATTRIBUTE attribute:ATTRIBUTE.values()) attribute2Grouping2Composition.put(attribute, getComposition(sequence, attribute));
137137
return attribute2Grouping2Composition;
138138
}
139139

140140
@Override
141141
public Map<TRANSITION, Double> getTransition(ProteinSequence sequence, ATTRIBUTE attribute) throws Exception {
142-
Map<TRANSITION, Double> transition2Double = new HashMap<TRANSITION, Double>();
142+
Map<TRANSITION, Double> transition2Double = new HashMap<>();
143143
for(TRANSITION transition:TRANSITION.values()) transition2Double.put(transition, getTransition(sequence, attribute, transition));
144144
return transition2Double;
145145
}
146146

147147
@Override
148148
public Map<ATTRIBUTE, Map<TRANSITION, Double>> getTransition(ProteinSequence sequence) throws Exception {
149-
Map<ATTRIBUTE, Map<TRANSITION, Double>> attribute2Transition2Double = new HashMap<ATTRIBUTE, Map<TRANSITION, Double>>();
149+
Map<ATTRIBUTE, Map<TRANSITION, Double>> attribute2Transition2Double = new HashMap<>();
150150
for(ATTRIBUTE attribute:ATTRIBUTE.values()) attribute2Transition2Double.put(attribute, getTransition(sequence, attribute));
151151
return attribute2Transition2Double;
152152
}
153153

154154
@Override
155155
public Map<DISTRIBUTION, Double> getDistributionPosition(ProteinSequence sequence, ATTRIBUTE attribute, GROUPING group) throws Exception {
156-
Map<DISTRIBUTION, Double> distribution2Double = new HashMap<DISTRIBUTION, Double>();
156+
Map<DISTRIBUTION, Double> distribution2Double = new HashMap<>();
157157
for(DISTRIBUTION distribution:DISTRIBUTION.values())
158158
distribution2Double.put(distribution, getDistributionPosition(sequence, attribute, group, distribution));
159159
return distribution2Double;
160160
}
161161

162162
@Override
163163
public Map<GROUPING, Map<DISTRIBUTION, Double>> getDistributionPosition(ProteinSequence sequence, ATTRIBUTE attribute) throws Exception {
164-
Map<GROUPING, Map<DISTRIBUTION, Double>> grouping2Distribution2Double = new HashMap<GROUPING, Map<DISTRIBUTION, Double>>();
164+
Map<GROUPING, Map<DISTRIBUTION, Double>> grouping2Distribution2Double = new HashMap<>();
165165
for(GROUPING group:GROUPING.values())
166166
grouping2Distribution2Double.put(group, getDistributionPosition(sequence, attribute, group));
167167
return grouping2Distribution2Double;
@@ -170,7 +170,7 @@ public Map<GROUPING, Map<DISTRIBUTION, Double>> getDistributionPosition(ProteinS
170170
@Override
171171
public Map<ATTRIBUTE, Map<GROUPING, Map<DISTRIBUTION, Double>>> getDistributionPosition(ProteinSequence sequence) throws Exception {
172172
Map<ATTRIBUTE, Map<GROUPING, Map<DISTRIBUTION, Double>>> attribute2Grouping2Distribution2Double =
173-
new HashMap<ATTRIBUTE, Map<GROUPING, Map<DISTRIBUTION, Double>>>();
173+
new HashMap<>();
174174
for(ATTRIBUTE attribute:ATTRIBUTE.values())
175175
attribute2Grouping2Distribution2Double.put(attribute, getDistributionPosition(sequence, attribute));
176176
return attribute2Grouping2Distribution2Double;

biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/AminoAcidCompositionTable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private void generatesAminoAcidCompoundSet(){
8383
* Stores the mass of elements and isotopes
8484
*/
8585
public void computeMolecularWeight(ElementTable eTable){
86-
this.aaSymbol2MolecularWeight = new HashMap<Character, Double>();
86+
this.aaSymbol2MolecularWeight = new HashMap<>();
8787
for(AminoAcidComposition a:aminoacid){
8888
//Check to ensure that the symbol is of single character
8989
if(a.getSymbol().length() != 1){

biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/CaseFreeAminoAcidCompoundSet.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
*/
4040
public class CaseFreeAminoAcidCompoundSet implements CompoundSet<AminoAcidCompound> {
4141

42-
private final Map<String, AminoAcidCompound> aminoAcidCompoundCache = new HashMap<String, AminoAcidCompound>();
42+
private final Map<String, AminoAcidCompound> aminoAcidCompoundCache = new HashMap<>();
4343
private final Map<AminoAcidCompound, Set<AminoAcidCompound>> equivalentsCache =
44-
new HashMap<AminoAcidCompound, Set<AminoAcidCompound>>();
44+
new HashMap<>();
4545

4646
public CaseFreeAminoAcidCompoundSet() {
4747
aminoAcidCompoundCache.put("A", new AminoAcidCompound(null, "A", "Ala", "Alanine", 71.0788f));
@@ -83,7 +83,7 @@ public CaseFreeAminoAcidCompoundSet() {
8383
//which then does the actual conversion to Pyl.
8484
aminoAcidCompoundCache.put("O", new AminoAcidCompound(null, "O", "Pyl", "Pyrrolysine", 255.3172f));
8585

86-
Map<String, AminoAcidCompound> lowerCaseSet = new HashMap<String, AminoAcidCompound>();
86+
Map<String, AminoAcidCompound> lowerCaseSet = new HashMap<>();
8787
for(String s:this.aminoAcidCompoundCache.keySet()){
8888
lowerCaseSet.put(s.toLowerCase(), this.aminoAcidCompoundCache.get(s));
8989
}
@@ -144,7 +144,7 @@ public Set<AminoAcidCompound> getEquivalentCompounds(AminoAcidCompound compound)
144144
addAmbiguousEquivalents("I", "L", "J");
145145
// ambiguous gaps
146146
AminoAcidCompound gap1, gap2, gap3;
147-
Set<AminoAcidCompound> gaps = new HashSet<AminoAcidCompound>();
147+
Set<AminoAcidCompound> gaps = new HashSet<>();
148148
gaps.add(gap1 = aminoAcidCompoundCache.get("-"));
149149
gaps.add(gap2 = aminoAcidCompoundCache.get("."));
150150
gaps.add(gap3 = aminoAcidCompoundCache.get("_"));
@@ -162,18 +162,18 @@ private void addAmbiguousEquivalents(String one, String two, String either) {
162162
Set<AminoAcidCompound> equivalents;
163163
AminoAcidCompound cOne, cTwo, cEither;
164164

165-
equivalents = new HashSet<AminoAcidCompound>();
165+
equivalents = new HashSet<>();
166166
equivalents.add(cOne = aminoAcidCompoundCache.get(one));
167167
equivalents.add(cTwo = aminoAcidCompoundCache.get(two));
168168
equivalents.add(cEither = aminoAcidCompoundCache.get(either));
169169
equivalentsCache.put(cEither, equivalents);
170170

171-
equivalents = new HashSet<AminoAcidCompound>();
171+
equivalents = new HashSet<>();
172172
equivalents.add(cOne);
173173
equivalents.add(cEither);
174174
equivalentsCache.put(cOne, equivalents);
175175

176-
equivalents = new HashSet<AminoAcidCompound>();
176+
equivalents = new HashSet<>();
177177
equivalents.add(cTwo);
178178
equivalents.add(cEither);
179179
equivalentsCache.put(cTwo, equivalents);
@@ -186,7 +186,7 @@ public boolean hasCompound(AminoAcidCompound compound) {
186186

187187
@Override
188188
public List<AminoAcidCompound> getAllCompounds() {
189-
return new ArrayList<AminoAcidCompound>(aminoAcidCompoundCache.values());
189+
return new ArrayList<>(aminoAcidCompoundCache.values());
190190
}
191191

192192

biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/Element.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public List<Isotope> getIsotopes() {
120120

121121
public void setIsotopes(List<Isotope> isotopes) {
122122
this.isotope = isotopes;
123-
this.name2Isotope = new HashMap<String, Isotope>();
123+
this.name2Isotope = new HashMap<>();
124124
if(isotopes != null){
125125
for(Isotope i:isotopes){
126126
name2Isotope.put(i.getName(), i);

biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/ElementTable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public void setElement(List<Element> eList){
5858
* Populate the Maps for quick retrieval
5959
*/
6060
public void populateMaps(){
61-
this.elementName2Element = new HashMap<String, Element>();
62-
this.isotopeName2Isotope = new HashMap<String, Isotope>();
61+
this.elementName2Element = new HashMap<>();
62+
this.isotopeName2Isotope = new HashMap<>();
6363
if(this.element != null){
6464
for(Element e:this.element){
6565
this.elementName2Element.put(e.getName(), e);

0 commit comments

Comments
 (0)