Skip to content

Commit 0776cf8

Browse files
committed
Remove dead code
1 parent 731b324 commit 0776cf8

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

src/com/github/miachm/sods/SpreadSheet.java

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.github.miachm.sods;
22

33
import java.io.*;
4+
import java.nio.file.Files;
45
import java.util.ArrayList;
56
import java.util.Collections;
67
import java.util.Comparator;
@@ -107,8 +108,6 @@ public void addSheet(Sheet sheet,int pos) {
107108
* Remove all sheets of the book. This only remove the link, the sheets objects are not modified in any way.
108109
*/
109110
public void clear(){
110-
for (Sheet sheet : sheets) {
111-
}
112111
sheets.clear();
113112
}
114113

@@ -119,9 +118,7 @@ public void clear(){
119118
* @throws IndexOutOfBoundsException if the index is out of range
120119
*/
121120
public void deleteSheet(int pos) {
122-
Sheet removed = sheets.remove(pos);
123-
if (removed != null) {
124-
}
121+
sheets.remove(pos);
125122
}
126123

127124
/**
@@ -150,10 +147,7 @@ public boolean deleteSheet(String name){
150147
* @see #deleteSheet(String)
151148
*/
152149
public boolean deleteSheet(Sheet sheet){
153-
boolean removed = sheets.remove(sheet);
154-
if (removed) {
155-
}
156-
return removed;
150+
return sheets.remove(sheet);
157151
}
158152

159153
/**
@@ -213,9 +207,7 @@ public void setSheet(Sheet sheet, int pos)
213207
{
214208
if (sheet == null)
215209
throw new NullPointerException();
216-
Sheet old = sheets.set(pos,sheet);
217-
if (old != null) {
218-
}
210+
sheets.set(pos,sheet);
219211
}
220212

221213
/**
@@ -227,7 +219,7 @@ public void setSheet(Sheet sheet, int pos)
227219
* @throws IOException In case of an io error.
228220
*/
229221
public void save(File out) throws IOException {
230-
save(new FileOutputStream(out));
222+
save(Files.newOutputStream(out.toPath()));
231223
}
232224

233225
/**

0 commit comments

Comments
 (0)