-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathHash.java
More file actions
36 lines (30 loc) · 982 Bytes
/
Hash.java
File metadata and controls
36 lines (30 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package project_A;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class Hash {
@SuppressWarnings({ "resource", "static-access", "deprecation" })
public HashSet<String> getSet() throws IOException{
InputStream file = new Source().getFile();
XSSFWorkbook workBook = new XSSFWorkbook(file);
XSSFSheet sheet = workBook.getSheetAt(1);
HashSet <String> set = new HashSet<>();
for(int r=0; r<=sheet.getLastRowNum();r++){
XSSFRow Row = sheet.getRow(r);
for(int c=1; c<=4;c++){
XSSFCell Cell = Row.getCell(c,Row.CREATE_NULL_AS_BLANK);
String Value = Cell.getStringCellValue();
if(Value.equals("")){
}else{
set.add(Value);
}
}
}
file.close();
return set;
}
}