X Tutup
Skip to content

Commit 70e9a74

Browse files
authored
Merge pull request #1119 from Pasjonat90D/fix/use-isempty-instead-of-size-#1079
Fix #1079: Use isEmpty() instead of size() == 0
2 parents e6ba379 + 3f039fd commit 70e9a74

File tree

28 files changed

+38
-38
lines changed

28 files changed

+38
-38
lines changed

biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleAlignedSequence.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ private void setLocation(List<Step> steps) {
411411
}
412412

413413
// combine sublocations into 1 Location
414-
if (sublocations.size() == 0) {
414+
if (sublocations.isEmpty()) {
415415
location = null;
416416
} else if (sublocations.size() == 1) {
417417
location = sublocations.get(0);

biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public void addIntronsUsingExons() throws Exception {
119119
if (intronAdded) { //going to assume introns are correct
120120
return;
121121
}
122-
if (exonSequenceList.size() == 0) {
122+
if (exonSequenceList.isEmpty()) {
123123
return;
124124
}
125125
ExonComparator exonComparator = new ExonComparator();

biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/SequenceAsStringHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class SequenceAsStringHelper<C extends Compound> {
4444
*/
4545
public String getSequenceAsString(List<C> parsedCompounds, CompoundSet<C> compoundSet, Integer bioBegin, Integer bioEnd, Strand strand) {
4646
// TODO Optimise/cache.
47-
if(parsedCompounds.size() == 0)
47+
if(parsedCompounds.isEmpty())
4848
return "";
4949
StringBuilder builder = new StringBuilder();
5050
if (strand.equals(Strand.NEGATIVE)) {

biojava-core/src/main/java/org/biojava/nbio/core/util/PrettyXMLWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void declareNamespace(String nsURI, String prefixHint)
7272
private void handleDeclaredNamespaces()
7373
throws IOException
7474
{
75-
if (namespacesDeclared.size() == 0) {
75+
if (namespacesDeclared.isEmpty()) {
7676
for (Iterator<String> nsi = namespacesDeclared.iterator(); nsi.hasNext(); ) {
7777
String nsURI = nsi.next();
7878
if (!namespacePrefixes.containsKey(nsURI)) {

biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SequenceScalePanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private void setPrefSize() {
126126
public void setAligMap(List<AlignedPosition> apos){
127127
this.apos = apos;
128128

129-
if ( apos.size() == 0)
129+
if (apos.isEmpty())
130130
return;
131131

132132
AlignedPosition last = apos.get(apos.size()-1);

biojava-structure/src/main/java/org/biojava/nbio/structure/align/ClusterAltAligs.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public static void cluster(AlternativeAlignment[] aligs, int cutoff){
102102

103103
}
104104
clusters.add(currentCluster);
105-
if ( remainList.size() == 0) {
105+
if ( remainList.isEmpty()) {
106106
break;
107107
}
108108
}

biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/BlockImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public void setAlignRes(List<List<Integer>> alignRes) {
127127
public int length() {
128128
if (alignRes == null)
129129
return 0;
130-
if (alignRes.size() == 0)
130+
if (alignRes.isEmpty())
131131
return 0;
132132
return alignRes.get(0).size();
133133
}

biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/BlockSetImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public int size() {
179179
// Get the size from the variables that can contain the information
180180
if (parent != null)
181181
return parent.size();
182-
else if (getBlocks().size() == 0) {
182+
else if (getBlocks().isEmpty()) {
183183
throw new IndexOutOfBoundsException(
184184
"Empty BlockSet: number of Blocks == 0.");
185185
} else
@@ -194,7 +194,7 @@ public int getCoreLength() {
194194
}
195195

196196
protected void updateLength() {
197-
if (getBlocks().size() == 0) {
197+
if (getBlocks().isEmpty()) {
198198
throw new IndexOutOfBoundsException(
199199
"Empty BlockSet: number of Blocks == 0.");
200200
}
@@ -207,7 +207,7 @@ protected void updateLength() {
207207
}
208208

209209
protected void updateCoreLength() {
210-
if (getBlocks().size() == 0) {
210+
if (getBlocks().isEmpty()) {
211211
throw new IndexOutOfBoundsException(
212212
"Empty BlockSet: number of Blocks == 0.");
213213
}

biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/MultipleAlignmentImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public int getCoreLength() {
207207
* lengths.
208208
*/
209209
protected void updateLength() {
210-
if (getBlockSets().size() == 0) {
210+
if (getBlockSets().isEmpty()) {
211211
throw new IndexOutOfBoundsException(
212212
"Empty MultipleAlignment: blockSets size == 0.");
213213
} // Otherwise try to calculate it from the BlockSet information
@@ -223,7 +223,7 @@ protected void updateLength() {
223223
* BlockSet core lengths.
224224
*/
225225
protected void updateCoreLength() {
226-
if (getBlockSets().size() == 0) {
226+
if (getBlockSets().isEmpty()) {
227227
throw new IndexOutOfBoundsException(
228228
"Empty MultipleAlignment: blockSets size == 0.");
229229
} // Otherwise try to calculate it from the BlockSet information

biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/mc/MultipleMcOptimizer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public MultipleMcOptimizer(MultipleAlignment seedAln,
153153
for (Block b : toDelete) {
154154
for (BlockSet bs : msa.getBlockSets()) {
155155
bs.getBlocks().remove(b);
156-
if (bs.getBlocks().size() == 0)
156+
if (bs.getBlocks().isEmpty())
157157
emptyBs.add(bs);
158158
}
159159
}

0 commit comments

Comments
 (0)
X Tutup