diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/loader/GenbankProxySequenceReaderTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/loader/GenbankProxySequenceReaderTest.java index 6883637a49..0e8f7f41f5 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/loader/GenbankProxySequenceReaderTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/loader/GenbankProxySequenceReaderTest.java @@ -162,7 +162,7 @@ so it should be done here (manualy). logger.info("taxonomy name '{}'", taxonName); Assert.assertNotNull(taxonName); - if (seq.getFeaturesByType("CDS").size() > 0) { + if (!seq.getFeaturesByType("CDS").isEmpty()) { FeatureInterface, AminoAcidCompound> CDS = seq.getFeaturesByType("CDS").get(0); logger.info("CDS: {}", CDS); String codedBy = CDS.getQualifiers().get("coded_by").get(0).getValue(); diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/GeneFeatureHelper.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/GeneFeatureHelper.java index c9786b3ad0..b417c4608d 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/GeneFeatureHelper.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/GeneFeatureHelper.java @@ -36,7 +36,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class GeneFeatureHelper { @@ -418,7 +418,7 @@ static public void addGmodGFF3GeneFeatures(Map chrom String startCodonName = ""; String stopCodonName = ""; FeatureList startCodonList = mRNAChildren.selectByType("five_prime_UTR"); - if (startCodonList != null && startCodonList.size() > 0) { + if (startCodonList != null && !startCodonList.isEmpty()) { startCodon = startCodonList.get(0); if (strand == Strand.NEGATIVE) { startCodonBegin = startCodon.location().bioEnd(); @@ -430,7 +430,7 @@ static public void addGmodGFF3GeneFeatures(Map chrom FeatureList stopCodonList = mRNAChildren.selectByType("three_prime_UTR"); - if (stopCodonList != null && stopCodonList.size() > 0) { + if (stopCodonList != null && !stopCodonList.isEmpty()) { stopCodon = stopCodonList.get(0); if (strand == Strand.NEGATIVE) { stopCodonEnd = stopCodon.location().bioStart(); @@ -577,7 +577,7 @@ static public void addGlimmerGFF3GeneFeatures(Map ch String startCodonName = ""; String stopCodonName = ""; FeatureList startCodonList = gene.selectByAttribute("Note", "initial-exon"); - if (startCodonList != null && startCodonList.size() > 0) { + if (startCodonList != null && !startCodonList.isEmpty()) { startCodon = startCodonList.get(0); if (strand == Strand.NEGATIVE) { startCodonBegin = startCodon.location().bioEnd(); @@ -589,7 +589,7 @@ static public void addGlimmerGFF3GeneFeatures(Map ch FeatureList stopCodonList = gene.selectByAttribute("Note", "final-exon"); - if (stopCodonList != null && stopCodonList.size() > 0) { + if (stopCodonList != null && !stopCodonList.isEmpty()) { stopCodon = stopCodonList.get(0); if (strand == Strand.NEGATIVE) { stopCodonEnd = stopCodon.location().bioStart(); @@ -723,7 +723,7 @@ static public void addGeneMarkGTFGeneFeatures(Map ch String startCodonName = ""; String stopCodonName = ""; FeatureList startCodonList = transcriptFeature.selectByType("start_codon"); - if (startCodonList != null && startCodonList.size() > 0) { + if (startCodonList != null && !startCodonList.isEmpty()) { startCodon = startCodonList.get(0); if (strand == Strand.POSITIVE) { startCodonBegin = startCodon.location().bioStart(); @@ -735,7 +735,7 @@ static public void addGeneMarkGTFGeneFeatures(Map ch FeatureList stopCodonList = transcriptFeature.selectByType("stop_codon"); - if (stopCodonList != null && stopCodonList.size() > 0) { + if (stopCodonList != null && !stopCodonList.isEmpty()) { stopCodon = stopCodonList.get(0); if (strand == Strand.POSITIVE) { stopCodonEnd = stopCodon.location().bioEnd(); diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/homology/GFF3FromUniprotBlastHits.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/homology/GFF3FromUniprotBlastHits.java index 67e22bd992..1547aba2d9 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/homology/GFF3FromUniprotBlastHits.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/homology/GFF3FromUniprotBlastHits.java @@ -46,7 +46,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis * @author Mark Chapman */ public class GFF3FromUniprotBlastHits { @@ -163,7 +163,7 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(), String notes = ""; if (featureKeyWords != null) { List keyWords = featureKeyWords.getKeyWords(); - if (keyWords.size() > 0) { + if (!keyWords.isEmpty()) { notes = ";Note="; for (String note : keyWords) { if ("Complete proteome".equals(note)) { @@ -187,7 +187,7 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(), List cazyList = databaseReferenceHashMap.get("CAZy"); List goList = databaseReferenceHashMap.get("GO"); List eccList = databaseReferenceHashMap.get("BRENDA"); - if (pfamList != null && pfamList.size() > 0) { + if (pfamList != null && !pfamList.isEmpty()) { if (notes.length() == 0) { notes = ";Note="; } @@ -197,7 +197,7 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(), } } - if (cazyList != null && cazyList.size() > 0) { + if (cazyList != null && !cazyList.isEmpty()) { if (notes.length() == 0) { notes = ";Note="; } @@ -208,7 +208,7 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(), } } - if (eccList != null && eccList.size() > 0) { + if (eccList != null && !eccList.isEmpty()) { if (notes.length() == 0) { notes = ";Note="; } @@ -221,8 +221,8 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(), } } - if (goList != null && goList.size() > 0) { - if (notes.length() == 0) { + if (goList != null && !goList.isEmpty()) { + if (notes.isEmpty()) { notes = ";Note="; } for (DBReferenceInfo note : goList) { diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GFF3Writer.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GFF3Writer.java index 88af970928..0f8bd97884 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GFF3Writer.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GFF3Writer.java @@ -31,7 +31,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class GFF3Writer { @@ -122,7 +122,7 @@ public void write(OutputStream outputStream, Map chr private String getGFF3Note(List notesList) { String notes = ""; - if (notesList.size() > 0) { + if (!notesList.isEmpty()) { notes = ";Note="; int noteindex = 1; for (String note : notesList) { diff --git a/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/io/TestSeqResParsing.java b/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/io/TestSeqResParsing.java index de6c072719..6ea23aef8a 100644 --- a/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/io/TestSeqResParsing.java +++ b/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/io/TestSeqResParsing.java @@ -53,7 +53,7 @@ public void test11GS() throws IOException, StructureException{ s = StructureIO.getStructure(pdbID); assertNotNull(s); - assertTrue(s.getChains().size() > 0); + assertFalse(s.getChains().isEmpty()); Chain c = s.getChainByIndex(0); assertTrue(c.getSeqResGroups().size() > 2); diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ModifiedCompoundXMLConverter.java b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ModifiedCompoundXMLConverter.java index 187e113924..e038f57cd3 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ModifiedCompoundXMLConverter.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ModifiedCompoundXMLConverter.java @@ -69,7 +69,7 @@ public static String toXML(ModifiedCompound mc) throws IOException{ Set linkages = mc.getAtomLinkages(); - if ( linkages.size() > 0 ) { + if (!linkages.isEmpty()) { int pos = -1; for ( StructureAtomLinkage link: linkages){ pos ++; diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ProteinModificationIdentifier.java b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ProteinModificationIdentifier.java index c9575a5444..0d94d36e6e 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ProteinModificationIdentifier.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ProteinModificationIdentifier.java @@ -285,7 +285,7 @@ public void identify(final List chains, if (residues.isEmpty()) { String pdbId = "?"; - if ( chains.size() > 0) { + if (!chains.isEmpty()) { Structure struc = chains.get(0).getStructure(); if ( struc != null) pdbId = struc.getPDBCode(); diff --git a/biojava-modfinder/src/test/java/org/biojava/nbio/protmod/phosphosite/TestAcetylation.java b/biojava-modfinder/src/test/java/org/biojava/nbio/protmod/phosphosite/TestAcetylation.java index 34376307a0..ba8e6d2a3d 100644 --- a/biojava-modfinder/src/test/java/org/biojava/nbio/protmod/phosphosite/TestAcetylation.java +++ b/biojava-modfinder/src/test/java/org/biojava/nbio/protmod/phosphosite/TestAcetylation.java @@ -32,7 +32,8 @@ import java.net.URL; import java.util.List; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; @@ -100,11 +101,11 @@ public void testAcetylation() throws IOException { List sites = Site.parseSites(localFile); - assertTrue(sites.size() > 0); + assertFalse(sites.isEmpty()); for (Site s : sites) { - assertTrue(s.getResidue() != null); + assertNotNull(s.getResidue()); } diff --git a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/utils/WeakValueHashMap.java b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/utils/WeakValueHashMap.java index 7762642c76..c508cdc206 100644 --- a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/utils/WeakValueHashMap.java +++ b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/utils/WeakValueHashMap.java @@ -58,12 +58,12 @@ public WeakValueHashMap() { private void diddleReferenceQueue() { // Avoid making behind-the-scenes modifications while iterators exist. - if (iteratorRefs.size() > 0) { + if (!iteratorRefs.isEmpty()) { Reference ref; while ((ref = iteratorRefQueue.poll()) != null) { iteratorRefs.remove(ref); } - if (iteratorRefs.size() > 0) { + if (!iteratorRefs.isEmpty()) { return; } } diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/JAutoSuggest.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/JAutoSuggest.java index 9e3c825910..c5542b4edc 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/JAutoSuggest.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/JAutoSuggest.java @@ -229,7 +229,7 @@ public void keyReleased(KeyEvent e) { list.ensureIndexIsVisible(list.getSelectedIndex() - 1); return; } else if (e.getKeyCode() == KeyEvent.VK_ENTER - && list.getSelectedIndex() != -1 && suggestions.size() > 0) { + && list.getSelectedIndex() != -1 && !suggestions.isEmpty()) { setText((String) list.getSelectedValue()); @@ -365,7 +365,7 @@ public String doInBackground() { setFont(regular); - if (suggestions.size() > 0) { + if (!suggestions.isEmpty()) { list.setListData(suggestions); list.setSelectedIndex(0); list.ensureIndexIsVisible(0); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/SCOPAutoSuggestProvider.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/SCOPAutoSuggestProvider.java index 136f184584..8e1a975205 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/SCOPAutoSuggestProvider.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/SCOPAutoSuggestProvider.java @@ -111,7 +111,7 @@ private List getPossibleScopDomains(String userInput) { if ( stop.get()) return domains; - if ( domains == null || domains.size() < 1){ + if ( domains == null || domains.isEmpty()){ if ( userInput.length() > 5){ // e.g. d4hhba @@ -127,11 +127,11 @@ private List getPossibleScopDomains(String userInput) { if (DEBUG) System.out.println("domains: " + domains); - if ( domains == null || domains.size() < 1) { + if ( domains == null || domains.isEmpty()) { if ( userInput.length() > 0 ){ List descs = scop.filterByClassificationId(userInput); - if ( descs == null || descs.size() < 1){ + if ( descs == null || descs.isEmpty()){ descs = scop.filterByDescription(userInput); } diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/RasmolCommandListener.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/RasmolCommandListener.java index d1ce5c0e30..feec8b0366 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/RasmolCommandListener.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/RasmolCommandListener.java @@ -74,7 +74,7 @@ public void actionPerformed(ActionEvent event) { // check last command in history // if equivalent, don't add, // otherwise add - if (history.size()>0){ + if (!history.isEmpty()){ String txt=history.get(history.size()-1); if (! txt.equals(cmd)) { history.add(cmd); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/Site.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/Site.java index 9158906d23..341483f31b 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/Site.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/Site.java @@ -83,7 +83,7 @@ public String toPDB() { @Override public void toPDB(StringBuffer buf) { - if (groups == null || groups.size() < 1) { + if (groups == null || groups.isEmpty()) { return; } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentWriter.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentWriter.java index 771b8b5f68..5033576df0 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentWriter.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentWriter.java @@ -205,7 +205,7 @@ public static String toTransformMatrices(MultipleAlignment alignment) { List btransforms = alignment.getBlockSet(bs) .getTransformations(); - if (btransforms == null || btransforms.size() < 1) + if (btransforms == null || btransforms.isEmpty()) continue; if (alignment.getBlockSets().size() > 1) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java index c6791f4ed2..e535a87508 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java @@ -1313,7 +1313,7 @@ public static Group[] prepareGroupsForDisplay(AFPChain afpChain, Atom[] ca1, Ato if ( afpChain.getBlockNum() > 0){ // Superimpose ligands relative to the first block - if( hetatms2.size() > 0 ) { + if(!hetatms2.isEmpty()) { if ( afpChain.getBlockRotationMatrix().length > 0 ) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/MultipleAlignmentXMLParser.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/MultipleAlignmentXMLParser.java index 759ee61931..e8d5434578 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/MultipleAlignmentXMLParser.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/MultipleAlignmentXMLParser.java @@ -169,7 +169,7 @@ else if ("ScoresCache".equals(child.getNodeName())){ } } //Because if it is 0 means that there were no transformations - if (transforms.size() != 0){ + if (!transforms.isEmpty()){ bs.setTransformations(transforms); } return bs; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GroupContact.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GroupContact.java index 07b163730d..245d4481f6 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GroupContact.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GroupContact.java @@ -57,7 +57,7 @@ public void setPair(Pair pair) { } public double getMinDistance() { - if (atomContacts.size()==0) return 0; + if (atomContacts.isEmpty()) return 0; double minDistance = Double.MAX_VALUE; for (AtomContact atomContact:atomContacts) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterfaceList.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterfaceList.java index 60f7c3a91b..00cf7ef65c 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterfaceList.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterfaceList.java @@ -380,7 +380,7 @@ public List getClusters(double contactOverlapScoreClu clusters = new ArrayList<>(); // nothing to do if we have no interfaces - if (list.size()==0) return clusters; + if (list.isEmpty()) return clusters; logger.debug("Calculating all-vs-all Jaccard scores for {} interfaces", list.size()); double[][] matrix = new double[list.size()][list.size()]; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/BondMaker.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/BondMaker.java index e6b8548025..e81f7fb867 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/BondMaker.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/BondMaker.java @@ -273,7 +273,7 @@ private void trimBondLists() { for (Chain chain : structure.getChains(modelInd)) { for (Group group : chain.getAtomGroups()) { for (Atom atom : group.getAtoms()) { - if (atom.getBonds()!=null && atom.getBonds().size() > 0) { + if (atom.getBonds()!=null && !atom.getBonds().isEmpty()) { ((ArrayList) atom.getBonds()).trimToSize(); } } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java index 58e4ee6625..f5cc851fec 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java @@ -1943,7 +1943,7 @@ private Group getCorrectAltLocGroup( Character altLoc, // see if we know this altLoc already; List atoms = currentGroup.getAtoms(); - if ( atoms.size() > 0) { + if (!atoms.isEmpty()) { Atom a1 = atoms.get(0); // we are just adding atoms to the current group // probably there is a second group following later... @@ -1956,7 +1956,7 @@ private Group getCorrectAltLocGroup( Character altLoc, List altLocs = currentGroup.getAltLocs(); for ( Group altLocG : altLocs ){ atoms = altLocG.getAtoms(); - if ( atoms.size() > 0) { + if (!atoms.isEmpty()) { for ( Atom a1 : atoms) { if (a1.getAltLoc().equals( altLoc)) { @@ -2921,7 +2921,7 @@ private void triggerEndFileChecks(){ pdbHeader.setBioAssemblies(bioAssemblyParser.getTransformationMap()); } - if (ncsOperators !=null && ncsOperators.size()>0) { + if (ncsOperators !=null && !ncsOperators.isEmpty()) { crystallographicInfo.setNcsOperators( ncsOperators.toArray(new Matrix4d[ncsOperators.size()])); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java index 7ee21de4b4..0652ad1809 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java @@ -198,7 +198,7 @@ public void mapSeqresRecords(Chain atomRes, Chain seqRes) { } } - if ( atomRes.getAtomGroups(GroupType.AMINOACID).size() < 1) { + if (atomRes.getAtomGroups(GroupType.AMINOACID).isEmpty()) { logger.debug("ATOM chain {} does not contain amino acids, ignoring...", atomRes.getId()); return; } @@ -215,7 +215,7 @@ public void mapSeqresRecords(Chain atomRes, Chain seqRes) { private void alignNucleotideChains(Chain seqRes, Chain atomRes) { - if ( atomRes.getAtomGroups(GroupType.NUCLEOTIDE).size() < 1) { + if (atomRes.getAtomGroups(GroupType.NUCLEOTIDE).isEmpty()) { logger.debug("ATOM chain {} does not contain nucleotides, ignoring...", atomRes.getId()); return; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/CifStructureConsumerImpl.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/CifStructureConsumerImpl.java index 67514edd84..03ebd027c6 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/CifStructureConsumerImpl.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/CifStructureConsumerImpl.java @@ -372,7 +372,7 @@ public void consumeAtomSite(AtomSite atomSite) { private Group getAltLocGroup(String recordName, Character altLoc, Character oneLetterCode, String threeLetterCode, long seqId) { List atoms = currentGroup.getAtoms(); - if (atoms.size() > 0) { + if (!atoms.isEmpty()) { if (atoms.get(0).getAltLoc().equals(altLoc)) { return currentGroup; } @@ -381,7 +381,7 @@ private Group getAltLocGroup(String recordName, Character altLoc, Character oneL List altLocs = currentGroup.getAltLocs(); for (Group altLocGroup : altLocs) { atoms = altLocGroup.getAtoms(); - if (atoms.size() > 0) { + if (!atoms.isEmpty()) { for (Atom a1 : atoms) { if (a1.getAltLoc().equals(altLoc)) { return altLocGroup; @@ -1478,7 +1478,7 @@ private void setStructNcsOps() { } } - if (ncsOperators.size() > 0) { + if (!ncsOperators.isEmpty()) { structure.getCrystallographicInfo() .setNcsOperators(ncsOperators.toArray(new Matrix4d[0])); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfStructureReader.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfStructureReader.java index 21ef8bb64c..865c9e0da4 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfStructureReader.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfStructureReader.java @@ -372,7 +372,7 @@ public void setInterGroupBond(int indOne, int indTwo, int bondOrder) { private Group getCorrectAltLocGroup(Character altLoc) { // see if we know this altLoc already; List atoms = group.getAtoms(); - if (atoms.size() > 0) { + if (!atoms.isEmpty()) { Atom a1 = atoms.get(0); // we are just adding atoms to the current group // probably there is a second group following later... diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyTransformation.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyTransformation.java index 36bccd7b39..ff1efd6e32 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyTransformation.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyTransformation.java @@ -226,7 +226,7 @@ public static BiologicalAssemblyTransformation fromXML(String xml) List transformations = fromMultiXML(xml); - if ( transformations.size() > 0) + if (!transformations.isEmpty()) return transformations.get(0); else diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopInstallation.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopInstallation.java index d092d5485e..4ac55cfa08 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopInstallation.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopInstallation.java @@ -655,7 +655,7 @@ private List extractRanges(String range) { } protected void downloadClaFile() throws IOException{ - if(mirrors.size()<1) { + if(mirrors.isEmpty()) { initScopURLs(); } IOException exception = null; @@ -676,7 +676,7 @@ protected void downloadClaFile() throws IOException{ } protected void downloadDesFile() throws IOException{ - if(mirrors.size()<1) { + if(mirrors.isEmpty()) { initScopURLs(); } IOException exception = null; @@ -697,7 +697,7 @@ protected void downloadDesFile() throws IOException{ } protected void downloadHieFile() throws IOException{ - if(mirrors.size()<1) { + if(mirrors.isEmpty()) { initScopURLs(); } IOException exception = null; @@ -719,7 +719,7 @@ protected void downloadHieFile() throws IOException{ } protected void downloadComFile() throws IOException{ - if(mirrors.size()<1) { + if(mirrors.isEmpty()) { initScopURLs(); } IOException exception = null; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/PermutationGroup.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/PermutationGroup.java index e1f4792410..b3ac53f385 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/PermutationGroup.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/PermutationGroup.java @@ -65,7 +65,7 @@ public void completeGroup() { Set> known = new HashSet<>(permutations); //breadth-first search through the map of all members List> currentLevel = new ArrayList<>(permutations); - while( currentLevel.size() > 0) { + while(!currentLevel.isEmpty()) { List> nextLevel = new ArrayList<>(); for( List p : currentLevel) { for(List gen : gens) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetrySubunits.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetrySubunits.java index b0bef7f1e6..7f434cabaf 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetrySubunits.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetrySubunits.java @@ -211,7 +211,7 @@ public MomentsOfInertia getMomentsOfInertia() { } private void run() { - if (centers.size() > 0) { + if (!centers.isEmpty()) { return; } calcOriginalCenters(); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/RotationGroup.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/RotationGroup.java index 1490d27036..002d046e52 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/RotationGroup.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/RotationGroup.java @@ -83,7 +83,7 @@ public void removeRotation(int index) { public void complete() { if (modified) { - if (rotations.size() > 0) { + if (!rotations.isEmpty()) { findHighestOrderAxis(); setEAxis(); calcAxesDirections(); @@ -344,7 +344,7 @@ private void calcPointGroup() { // when a structure is symmetric, some subunits are below the rmsd threshold, // and some are just above the rmsd threshold int n = 0; - if (rotations.size() > 0) { + if (!rotations.isEmpty()) { n = rotations.get(0).getPermutation().size(); rotations.clear(); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SequenceFunctionRefiner.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SequenceFunctionRefiner.java index a6ad226698..0d52e92fef 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SequenceFunctionRefiner.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SequenceFunctionRefiner.java @@ -79,7 +79,7 @@ public static AFPChain refineSymmetry(AFPChain afpChain, Atom[] ca1, Atom[] ca2, // Refine the alignment Map Map refined = refineSymmetry(alignment, k); - if (refined.size() < 1) + if (refined.isEmpty()) throw new RefinerFailedException("Refiner returned empty alignment"); //Substitute and partition the alignment diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmOptimizer.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmOptimizer.java index d03e90080f..627908ac8b 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmOptimizer.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmOptimizer.java @@ -392,10 +392,7 @@ private boolean checkGaps() { length--; } - if (shrinkColumns.size() != 0) - return true; - else - return false; + return !shrinkColumns.isEmpty(); } /** diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/BlastClustReader.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/BlastClustReader.java index b2b3298157..5d1faa8754 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/BlastClustReader.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/BlastClustReader.java @@ -140,7 +140,7 @@ public List> getChainIdsInEntry(String pdbId) { private void loadClusters(int sequenceIdentity) { // load clusters only once - if (clusters.size() > 0) { + if (!clusters.isEmpty()) { return; } diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/align/util/AtomCacheTest.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/align/util/AtomCacheTest.java index 073a679dbb..f2f06ed2f5 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/align/util/AtomCacheTest.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/align/util/AtomCacheTest.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.fail; import java.io.File; @@ -408,7 +409,7 @@ public void testEmptyChemComp() throws IOException, StructureException { // should be unknown ChemComp chem = g.getChemComp(); assertNotNull(chem); - assertTrue(chem.getAtoms().size() > 0); + assertFalse(chem.getAtoms().isEmpty()); assertEquals("NON-POLYMER", chem.getType()); } finally { FileDownloadUtils.deleteDirectory(tmpCache); @@ -471,7 +472,7 @@ public void testEmptyGZChemComp() throws IOException, StructureException { // should be unknown ChemComp chem = g.getChemComp(); assertNotNull(chem); - assertTrue(chem.getAtoms().size() > 0); + assertFalse(chem.getAtoms().isEmpty()); assertEquals("NON-POLYMER", chem.getType()); } finally { FileDownloadUtils.deleteDirectory(tmpCache); diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestHeaderOnly.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestHeaderOnly.java index d3c9568240..f579752d4c 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestHeaderOnly.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestHeaderOnly.java @@ -205,8 +205,7 @@ public boolean doSeqResHaveAtoms(Structure s) { * @return true if has any Atom(s) */ public boolean hasAtoms(Group g) { - if (g.getAtoms().size() > 0) return true; - return false; + return !g.getAtoms().isEmpty(); } /** diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestMMcifOrganismParsing.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestMMcifOrganismParsing.java index 8d018f6c0a..2cbdbca679 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestMMcifOrganismParsing.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestMMcifOrganismParsing.java @@ -37,7 +37,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; public class TestMMcifOrganismParsing { @@ -90,7 +90,7 @@ private void checkPDB(String pdbId, String organismTaxId) throws IOException, St Structure s = StructureIO.getStructure(pdbId); assertNotNull(s.getEntityInfos()); - assertTrue(s.getEntityInfos().size() > 0); + assertFalse(s.getEntityInfos().isEmpty()); for ( EntityInfo c : s.getEntityInfos()) { if(EntityType.POLYMER.equals(c.getType())) { diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestSiftsParsing.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestSiftsParsing.java index 6a9f6ae93c..2b99d660d8 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestSiftsParsing.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestSiftsParsing.java @@ -47,9 +47,9 @@ public void test4DIA() throws Exception { for (SiftsEntity e : entities) { //System.out.println(e.getEntityId() + " " +e.getType()); - Assert.assertTrue(e.getSegments().size() > 0); + Assert.assertFalse(e.getSegments().isEmpty()); for (SiftsSegment seg : e.getSegments()) { - Assert.assertTrue(seg.getResidues().size() > 0); + Assert.assertFalse(seg.getResidues().isEmpty()); for (SiftsResidue res : seg.getResidues()) { @@ -78,9 +78,9 @@ public void test4jn3() throws Exception { for (SiftsEntity e : entities) { //System.out.println(e.getEntityId() + " " +e.getType()); - Assert.assertTrue(e.getSegments().size() > 0); + Assert.assertFalse(e.getSegments().isEmpty()); for (SiftsSegment seg : e.getSegments()) { - Assert.assertTrue(seg.getResidues().size() > 0); + Assert.assertFalse(seg.getResidues().isEmpty()); //System.out.println(seg.getResidues().size()); //System.out.println(" Segment: " + seg.getSegId() + " " + seg.getStart() + " " + seg.getEnd()) ; @@ -125,7 +125,7 @@ public void test4DOU() throws Exception { //assertTrue(seg1.getResidues().size() == 17); for (SiftsSegment seg : e.getSegments()) { - Assert.assertTrue(seg.getResidues().size() > 0); + Assert.assertFalse(seg.getResidues().isEmpty()); //System.out.println(" Segment: " + seg.getSegId() + " " + seg.getStart() + " " + seg.getEnd() + " res. size: " + seg.getResidues().size()) ; @@ -175,7 +175,7 @@ public void test4O6W() throws Exception { //System.out.println(" Segment: " + seg1.getSegId() + " " + seg1.getStart() + " " + seg1.getEnd() + " res. size: " + seg1.getResidues().size()); //assertTrue(seg1.getResidues().size() == 17); - Assert.assertTrue(seg.getResidues().size() > 0); + Assert.assertFalse(seg.getResidues().isEmpty()); for (SiftsResidue res : seg.getResidues()) { diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/cif/CifFileConsumerImplTest.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/cif/CifFileConsumerImplTest.java index a8925afa88..8fbd1060b0 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/cif/CifFileConsumerImplTest.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/cif/CifFileConsumerImplTest.java @@ -147,7 +147,7 @@ public void testWaterOnlyChainCif() throws IOException { Chain c = s2.getWaterChainByPDB("F"); assertNotNull("Got null when looking for water-only chain with author id F", c); - assertTrue(c.getAtomGroups().size() > 0); + assertFalse(c.getAtomGroups().isEmpty()); // checking that compounds are linked assertNotNull(c.getEntityInfo()); @@ -157,7 +157,7 @@ public void testWaterOnlyChainCif() throws IOException { Chain cAsymId = s2.getWaterChain("E"); assertNotNull("Got null when looking for water-only chain with asym id E", cAsymId); - assertTrue(cAsymId.getAtomGroups().size() > 0); + assertFalse(cAsymId.getAtomGroups().isEmpty()); assertSame(c, cAsymId); } diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxInfo.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxInfo.java index c9f4f18056..eebdaf86ba 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxInfo.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxInfo.java @@ -32,7 +32,7 @@ /** * Holds the results of a cox analysis where calling dump(), toString() will give an output similar to R - * @author Scooter Willis + * @author Scooter Willis */ public class CoxInfo { @@ -505,7 +505,7 @@ public String toString(String beginLine, String del, String endLine) { o = o + beginLine + endLine; - if (baselineSurvivorFunction.size() > 0) { + if (!baselineSurvivorFunction.isEmpty()) { o = o + beginLine + "Baseline Survivor Function (at predictor means)" + endLine; for (Double time : baselineSurvivorFunction.keySet()) { Double mean = baselineSurvivorFunction.get(time); diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/ResidualsCoxph.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/ResidualsCoxph.java index 42b34905cc..955a7c1f6d 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/ResidualsCoxph.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/ResidualsCoxph.java @@ -29,7 +29,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class ResidualsCoxph { @@ -108,7 +108,7 @@ public static double[][] process(CoxInfo ci, Type type, boolean useWeighted, Arr double[] weighted = ci.getWeighted(); rr = Matrix.scale(rr, weighted); } - if (cluster != null && cluster.size() > 0) { + if (cluster != null && !cluster.isEmpty()) { rr = rowsum(rr, cluster); } diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java index 542085942e..17ed18419a 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java @@ -27,7 +27,7 @@ * Need to handle very large spreadsheets of expression data so keep memory * footprint low * - * @author Scooter Willis + * @author Scooter Willis */ public class WorkSheet { @@ -1391,7 +1391,7 @@ static public WorkSheet unionWorkSheetsRowJoin(WorkSheet w1, WorkSheet w2, boole ArrayList joinedColumns = new ArrayList<>(); joinedColumns.addAll(w1DataColumns); joinedColumns.addAll(w2DataColumns); - if (!joinedColumns.contains("META_DATA") && (w1MetaDataColumns.size() > 0 || w2MetaDataColumns.size() > 0)) { + if (!joinedColumns.contains("META_DATA") && (!w1MetaDataColumns.isEmpty() || !w2MetaDataColumns.isEmpty())) { joinedColumns.add("META_DATA"); } for (String column : w1MetaDataColumns) {