11package com .github .miachm .sods ;
22
33import java .io .*;
4+ import java .nio .file .Files ;
45import java .util .ArrayList ;
56import java .util .Collections ;
67import 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