-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
260,832 additions
and
121,669 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
120,574 changes: 0 additions & 120,574 deletions
120,574
xxx-read-file-improvements/data-very-large.csv
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,2 @@ | ||
Reporting Period,Project Number,Legacy Project Number,City,,,,,,,,,, | ||
6/30/21,305,01001-00048,Babylon,,,,,,,,,, | ||
6/30/21,2011-188607-SLPR,,Syosset,,,,,,,,,, | ||
6/30/21,2011-157262-SLPR,,Bellport,,,,,,,,,, | ||
6/30/21,256419,,Queens,,,,,,,,,, | ||
5/30/21,2014-655036-Sola,,Babylon,,,,,,,,,, | ||
5/30/21,310687,,Babylon,,,,,,,,,, | ||
5/30/21,2014-648451-Sola,,Centereach,,,,,,,,,, | ||
5/30/21,2011-157191-SLPR,,Water Mill,,,,,,,,,, | ||
4/30/21,2013-636596-Sola,,Farmingdale,,,,,,,,,, | ||
Reporting Period,Project Number,Legacy Project Number,City,County,State,Zip Code,Sector,Program Type,Solicitation,Electric Utility,Purchase Type,Date Application Received,Date Completed,Project Status,Contractor,Primary Inverter Manufacturer,Primary Inverter Model Number,Total Inverter Quantity,Primary PV Module Manufacturer,PV Module Model Number,Total PV Module Quantity,Project Cost,$Incentive,Total Nameplate kW DC,Expected KWh Annual Production,Remote Net Metering,Affordable Solar,Community Distributed Generation,Green Jobs Green New York Participant,Georeference | ||
06/30/2021,0000000305,01001-00048,Williamson,Wayne,NY,14589,Non-Residential,Residential/Small Commercial,PON 1184,,,08/03/2003,06/23/2005,Complete,"Solar Works, Inc.",Fronius USA,IG 2500-LV,1,BP Solar,BP3125S,16,,,2.00,,,No,No,No,POINT (-77.175308 43.241518) |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
Hey Java developers, | ||
|
||
Reading files is difficult? | ||
Finding your self getting lost in a max of if statements and for loops when processing large files? | ||
|
||
Make it easier! | ||
[Where am I?!] | ||
|
||
Try using streams instead | ||
|
||
Stream, added in Java 8, and updated since then, provide many benefits when performing complex processing of large data sets | ||
|
||
In this example, to group, order, pr | ||
|
||
Happy coding! |
44 changes: 44 additions & 0 deletions
44
xxx-read-file-improvements/src/main/java/ElectricProject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import java.math.BigDecimal; | ||
import java.time.LocalDate; | ||
import java.time.Month; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
public record ElectricProject(LocalDate reportingPeriod, String projectNumber, String legacyProjectNumber, String city, | ||
String county, String state, String zipCode, String sector, String programType, String solicitation, | ||
String electricUtility, String purchaseType, LocalDate dateApplicationReceived, LocalDate dateCompleted, | ||
String projectStatus, String contractor, String primaryInverterManufacturer, String primaryInverterModelNumber, | ||
BigDecimal totalInverterQuantity, String primaryPVModuleManufacturer, String pvModuleModelNumber, | ||
BigDecimal totalPVModuleQuantity, BigDecimal projectCost, BigDecimal incentive, BigDecimal totalNameplatekWDC, | ||
BigDecimal expectedKWhAnnualProduction, String remoteNetMetering, String affordableSolar, | ||
String communityDistributed, String generationGreenJobsGreenNewYorkParticipant, String georeference) { | ||
|
||
static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); | ||
boolean reportingPeriodMatches(Month month) { | ||
return this.reportingPeriod.getMonth().equals(month); | ||
} | ||
|
||
static BigDecimal handleNumeric(String value) { | ||
try { | ||
return new BigDecimal(value); | ||
} catch (Exception e) { | ||
return BigDecimal.valueOf(0); | ||
} | ||
} | ||
|
||
static LocalDate handleDate(String value) { | ||
if (value.isBlank()) { | ||
return null; | ||
} else { | ||
return LocalDate.parse(value, formatter); | ||
} | ||
} | ||
|
||
static ElectricProject map(String[] values) { | ||
return new ElectricProject(handleDate(values[0]), values[1], values[2], values[3], values[4], values[5], | ||
values[6], values[7], values[8], values[9], values[10], values[11], handleDate(values[12]), | ||
handleDate(values[13]), values[14], values[15], values[16], values[17], handleNumeric(values[18]), | ||
values[19], values[20], handleNumeric(values[21]), handleNumeric(values[22]), handleNumeric(values[23]), | ||
handleNumeric(values[24]), handleNumeric(values[25]), values[26], values[27], values[28], values[29], | ||
values[30]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 0 additions & 45 deletions
45
xxx-read-file-improvements/src/main/java/FileReaderIII.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.