gpt4 book ai didi

java - 在 Java 中打开大型数据集和实例化数据时遇到问题

转载 作者:行者123 更新时间:2023-11-30 12:05:26 25 4
gpt4 key购买 nike

我正在尝试从 Java 中的 GIS 数据文本文件中读取数据,实例化每一行数据,然后对其进行排序、搜索和插入数据。我不断收到“在 java.util.Scanner.next(Unknown Source)”的问题并且一直无法解决这个问题。我还想知道是否有关于执行此操作的不同方法的建议。

我曾尝试使用数据类,在其中设置我需要访问的所有变量,创建 getter 和 setter 以及覆盖。然后我创建了一个新的数据数组,并使用了 if(input.hasNext()),我在其中设置了每个变量,然后创建了一个新的 GISData 实例。

public class GISRunner {

/**
* @param args
*/
public static void main(String[] args) throws FileNotFoundException {
File file = new File("C:\\Users\\Toby\\Desktop\\GIS.txt");
Scanner input = new Scanner(file);
input.useDelimiter("||\n");

GISData[] datas = new GISData[0];
if(input.hasNext()) {
int featureId = input.nextInt();
String featureName = input.next();
String featureClass = input.next();
String stateCode = input.next();
int stateId = input.nextInt();
String countyName = input.next();
int countyId = input.nextInt();
String primaryLatitudeDMS = input.next();
String primaryLongitudeDMS = input.next();
double primaryLatitudeDecimal = Double.valueOf(input.next().substring(1));
double primaryLongitudeDecimal = Double.valueOf(input.next().substring(1));
String sourceLatitudeDMS = input.next();
String sourceLongitudeDMS = input.next();
double sourceLatitudeDecimal = Double.valueOf(input.next().substring(1));
double sourceLongitudeDecimal = Double.valueOf(input.next().substring(1));
int elevationMeters = input.nextInt();
int elevationFeet = input.nextInt();
String mapName = input.next();

GISData newGISData = new GISData(featureId, featureName, featureClass, stateCode,
stateId, countyName, countyId, primaryLatitudeDMS, primaryLongitudeDMS,
primaryLatitudeDecimal, primaryLongitudeDecimal, sourceLatitudeDMS,
sourceLongitudeDMS, sourceLatitudeDecimal, sourceLongitudeDecimal, elevationMeters,
elevationFeet, mapName);
datas = addGISData(datas, newGISData);
}
for (GISData data : datas) {
System.out.println(data);
}
}

public static GISData[] addGISData(GISData[] datas, GISData dataToAdd) {
GISData[] newGISData = new GISData[datas.length + 1 ];
System.arraycopy(datas, 0, newGISData, 0, datas.length);
newGISData[newGISData.length - 1 ] = dataToAdd;

return newGISData;
}

}


public class GISData implements Comparable<GISData> {
public static enum SortByType {CountyName,
FeatureName,
PrimaryLatitude,
PrimaryLongitude,
SourceLatitude,
SourceLongitude,
ElevationFeet};

private int featureId;
private String featureName;
private String featureClass;
private String stateCode;
private int stateId;
private String countyName;
private int countyId;
private String primaryLatitudeDMS;
private String primaryLongitudeDMS;
private double primaryLatitudeDecimal;
private double primaryLongitudeDecimal;
private String sourceLatitudeDMS;
private String sourceLongitudeDMS;
private double sourceLatitudeDecimal;
private double sourceLongitudeDecimal;
private int elevationMeters;
private int elevationFeet;
private String mapName;
private Date createdDate;
private Date modifiedDate;
private SortByType[] sortBy;


public GISData(int featureId2, String featureName2, String featureClass2, String stateCode2, int stateId2,
String countyName2, int countyId2, String primaryLatitudeDMS2, String primaryLongitudeDMS2,
double primaryLatitudeDecimal2, double primaryLongitudeDecimal2, String sourceLatitudeDMS2, String sourceLongitudeDMS2, double sourceLatitudeDecimal2,
double sourceLongitudeDecimal2, int elevationMeters2, int elevationFeet2, String mapName2) {
featureId = featureId2;
featureName2 = featureName;
featureClass2 = featureClass;
stateCode2 = stateCode;
stateId2 = stateId;
countyName2 = countyName;
countyId2 = countyId;
primaryLatitudeDMS2 = primaryLatitudeDMS;
primaryLongitudeDMS2 = primaryLongitudeDMS;
primaryLatitudeDecimal2 = primaryLatitudeDecimal;
primaryLongitudeDecimal2 = primaryLongitudeDecimal;
sourceLatitudeDMS2 = sourceLatitudeDMS;
sourceLongitudeDMS2 = sourceLongitudeDMS;
sourceLatitudeDecimal2 = sourceLatitudeDecimal;
sourceLongitudeDecimal2 = sourceLongitudeDecimal;
elevationMeters2 = elevationMeters;
elevationFeet2 = elevationFeet;
mapName2 = mapName;
}
/**
* @return the featureId
*/
public int getFeatureId() {
return featureId;
}
/**
* @param featureId the featureId to set
*/
public void setFeatureId(int featureId) {
this.featureId = featureId;
}
/**
* @return the featureName
*/
public String getFeatureName() {
return featureName;
}
/**
* @param featureName the featureName to set
*/
public void setFeatureName(String featureName) {
this.featureName = featureName;
}
/**
* @return the featureClass
*/
public String getFeatureClass() {
return featureClass;
}
/**
* @param featureClass the featureClass to set
*/
public void setFeatureClass(String featureClass) {
this.featureClass = featureClass;
}
/**
* @return the stateCode
*/
public String getStateCode() {
return stateCode;
}
/**
* @param stateCode the stateCode to set
*/
public void setStateCode(String stateCode) {
this.stateCode = stateCode;
}
/**
* @return the stateId
*/
public int getStateId() {
return stateId;
}
/**
* @param stateId the stateId to set
*/
public void setStateId(int stateId) {
this.stateId = stateId;
}
/**
* @return the countyName
*/
public String getCountyName() {
return countyName;
}
/**
* @param countyName the countyName to set
*/
public void setCountyName(String countyName) {
this.countyName = countyName;
}
/**
* @return the countyId
*/
public int getCountyId() {
return countyId;
}
/**
* @param countyId the countyId to set
*/
public void setCountyId(int countyId) {
this.countyId = countyId;
}
/**
* @return the primaryLatitudeDMS
*/
public String getPrimaryLatitudeDMS() {
return primaryLatitudeDMS;
}
/**
* @param primaryLatitudeDMS the primaryLatitudeDMS to set
*/
public void setPrimaryLatitudeDMS(String primaryLatitudeDMS) {
this.primaryLatitudeDMS = primaryLatitudeDMS;
}
/**
* @return the primaryLongitudeDMS
*/
public String getPrimaryLongitudeDMS() {
return primaryLongitudeDMS;
}
/**
* @param primaryLongitudeDMS the primaryLongitudeDMS to set
*/
public void setPrimaryLongitudeDMS(String primaryLongitudeDMS) {
this.primaryLongitudeDMS = primaryLongitudeDMS;
}
/**
* @return the primaryLatitudeDecimal
*/
public double getPrimaryLatitudeDecimal() {
return primaryLatitudeDecimal;
}
/**
* @param primaryLatitudeDecimal the primaryLatitudeDecimal to set
*/
public void setPrimaryLatitudeDecimal(double primaryLatitudeDecimal) {
this.primaryLatitudeDecimal = primaryLatitudeDecimal;
}
/**
* @return the primaryLongitudeDecimal
*/
public double getPrimaryLongitudeDecimal() {
return primaryLongitudeDecimal;
}
/**
* @param primaryLongitudeDecimal the primaryLongitudeDecimal to set
*/
public void setPrimaryLongitudeDecimal(double primaryLongitudeDecimal) {
this.primaryLongitudeDecimal = primaryLongitudeDecimal;
}
/**
* @return the sourceLatitudeDMS
*/
public String getSourceLatitudeDMS() {
return sourceLatitudeDMS;
}
/**
* @param sourceLatitudeDMS the sourceLatitudeDMS to set
*/
public void setSourceLatitudeDMS(String sourceLatitudeDMS) {
this.sourceLatitudeDMS = sourceLatitudeDMS;
}
/**
* @return the sourceLongitudeDMS
*/
public String getSourceLongitudeDMS() {
return sourceLongitudeDMS;
}
/**
* @param sourceLongitudeDMS the sourceLongitudeDMS to set
*/
public void setSourceLongitudeDMS(String sourceLongitudeDMS) {
this.sourceLongitudeDMS = sourceLongitudeDMS;
}
/**
* @return the sourceLatitudeDecimal
*/
public double getSourceLatitudeDecimal() {
return sourceLatitudeDecimal;
}
/**
* @param sourceLatitudeDecimal the sourceLatitudeDecimal to set
*/
public void setSourceLatitudeDecimal(double sourceLatitudeDecimal) {
this.sourceLatitudeDecimal = sourceLatitudeDecimal;
}
/**
* @return the sourceLongitudeDecimal
*/
public double getSourceLongitudeDecimal() {
return sourceLongitudeDecimal;
}
/**
* @param sourceLongitudeDecimal the sourceLongitudeDecimal to set
*/
public void setSourceLongitudeDecimal(double sourceLongitudeDecimal) {
this.sourceLongitudeDecimal = sourceLongitudeDecimal;
}
/**
* @return the elevationMeters
*/
public int getElevationMeters() {
return elevationMeters;
}
/**
* @param elevationMeters the elevationMeters to set
*/
public void setElevationMeters(int elevationMeters) {
this.elevationMeters = elevationMeters;
}
/**
* @return the elevationFeet
*/
public int getElevationFeet() {
return elevationFeet;
}
/**
* @param elevationFeet the elevationFeet to set
*/
public void setElevationFeet(int elevationFeet) {
this.elevationFeet = elevationFeet;
}
/**
* @return the mapName
*/
public String getMapName() {
return mapName;
}
/**
* @param mapName the mapName to set
*/
public void setMapName(String mapName) {
this.mapName = mapName;
}
/**
* @return the createdDate
*/
public Date getCreatedDate() {
return createdDate;
}
/**
* @param createdDate the createdDate to set
*/
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
/**
* @return the modifiedDate
*/
public Date getModifiedDate() {
return modifiedDate;
}
/**
* @param modifiedDate the modifiedDate to set
*/
public void setModifiedDate(Date modifiedDate) {
this.modifiedDate = modifiedDate;
}
/**
* @return the sortBy
*/
public SortByType[] getSortBy() {
return sortBy;
}
/**
* @param sortBy the sortBy to set
*/
public void setSortBy(SortByType[] sortBy) {
this.sortBy = sortBy;
}
@Override
public int compareTo(GISData o) {
/**
* Make sure to complete this section in such a way that the
* type of comparison can easily be changed to factor in the different
* types of comparisons you need to make. I've given you a mechanism
* in the class to essentially select the comparison type. You can use that
* or you could code different methods, call those methods from here
* and comment out the methods you won't use. It's up to you.
*/
return 0;
}
@Override
public String toString() {
return String.format("ID: %s\r\nName: %s\r\nClass: %s\r\n");
}
}

我期望我加载的每个数据实例的输出。虽然这是一个巨大的数据集,但我只是希望能够将我的数据加载到程序中。此外,如果有人从这里对我可以编写的有效排序和搜索数据的方法有任何建议,我将不胜感激。

(我使用的数据集:https://s3.us-east-1.amazonaws.com/blackboard.learn.xythos.prod/5744b9beb8ccb/8090292?response-content-disposition=inline%3B%20filename%2A%3DUTF-8%27%27CA_Features_20190301.txt&response-content-type=text%2Fplain&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20190525T170332Z&X-Amz-SignedHeaders=host&X-Amz-Expires=21599&X-Amz-Credential=AKIAIL7WQYDOOHAZJGWQ%2F20190525%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=a0e4ce710ad5f5226b3f60544d897c7bd5cd1da59632e5248655b149ef56f7e3)

最佳答案

Apache Commons CSV

我让 Apache Commons CSV图书馆负责阅读我的文本文件。 (注意:JavaDoc 是 here – 他们在主页上的链接已损坏。)

我从 CSVFormat.TDF 格式定义开始,然后将其更改为使用 VERTICAL BAR(竖线,|)而不是制表符作为分隔符。

我使用了 enum命名输入数据的所有字段。但这是可选的,您可以使用字符串名称。

当心浮点类型double trading away accuracy为了执行速度。如果您希望您的号码保持完整,请使用 BigDecimal .

通过使用对象而不是基元,我们可以使用 null 来显示您输入的位置缺少数据。

我使用三元运算符来测试 NULL 值。三元组只是折叠成一行的 if-the-else 语句,使用的语法为:

result = test ? valueToUseIfTestIsTrue : valueToUseIfTestIsFalse ; 

示例:如果以米为单位的海拔为空字符串,则记录 NULL。否则,将传入的字符串解析为 Integer 对象。

Integer ELEV_IN_M = record.get( FIELD.ELEV_IN_M ).isBlank() ? null : Integer.valueOf( record.get( FIELD.ELEV_IN_M ) );

String::isBlank方法是 Java 11 中的新方法。它测试空字符串或完全由空白字符组成的字符串。对于早期的 Java,替换为 String::isEmpty在 Java 6 及更高版本中。你的数据似乎只有空字符串,没有空格,但我没有验证这个观察结果。

跳过 getter/setter 方法。只需使用 public 成员变量,直到所有其他代码都正常工作,并且直到您有特定的理由对访问器方法进行分层。

为了更快地编写此演示代码,我只是按原样复制粘贴了数据文件的文件名,全部大写。我没有费心按照规范的 Java 更改为驼峰命名法。

这是一个完整的工作示例,在一个大类中,在 main 方法中有一个演示。

package work.basil.example;

import org.apache.commons.csv.*;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.math.BigDecimal;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;

public class Gis
{
public enum FIELD
{
FEATURE_ID, FEATURE_NAME, FEATURE_CLASS, STATE_ALPHA, STATE_NUMERIC, COUNTY_NAME, COUNTY_NUMERIC, PRIMARY_LAT_DMS, PRIM_LONG_DMS, PRIM_LAT_DEC, PRIM_LONG_DEC, SOURCE_LAT_DMS, SOURCE_LONG_DMS, SOURCE_LAT_DEC, SOURCE_LONG_DEC, ELEV_IN_M, ELEV_IN_FT, MAP_NAME, DATE_CREATED, DATE_EDITED
}

public String FEATURE_NAME, FEATURE_CLASS, STATE_ALPHA, STATE_NUMERIC, COUNTY_NAME, COUNTY_NUMERIC, PRIMARY_LAT_DMS, PRIM_LONG_DMS, SOURCE_LAT_DMS, SOURCE_LONG_DMS, MAP_NAME;
public Integer FEATURE_ID, ELEV_IN_M, ELEV_IN_FT;
public BigDecimal PRIM_LAT_DEC, PRIM_LONG_DEC, SOURCE_LAT_DEC, SOURCE_LONG_DEC;
public LocalDate DATE_CREATED, DATE_EDITED;

// Constructor
public Gis ( Integer FEATURE_ID , String FEATURE_NAME , String FEATURE_CLASS , String STATE_ALPHA , String STATE_NUMERIC , String COUNTY_NAME , String COUNTY_NUMERIC , String PRIMARY_LAT_DMS , String PRIM_LONG_DMS , BigDecimal PRIM_LAT_DEC , BigDecimal PRIM_LONG_DEC , String SOURCE_LAT_DMS , String SOURCE_LONG_DMS , BigDecimal SOURCE_LAT_DEC , BigDecimal SOURCE_LONG_DEC , Integer ELEV_IN_M , Integer ELEV_IN_FT , String MAP_NAME , LocalDate DATE_CREATED , LocalDate DATE_EDITED )
{
Objects.requireNonNull( FEATURE_ID ); // … and so on.
this.FEATURE_ID = FEATURE_ID;
this.FEATURE_NAME = FEATURE_NAME;
this.FEATURE_CLASS = FEATURE_CLASS;
this.STATE_ALPHA = STATE_ALPHA;
this.STATE_NUMERIC = STATE_NUMERIC;
this.COUNTY_NAME = COUNTY_NAME;
this.COUNTY_NUMERIC = COUNTY_NUMERIC;
this.PRIMARY_LAT_DMS = PRIMARY_LAT_DMS;
this.PRIM_LONG_DMS = PRIM_LONG_DMS;
this.PRIM_LAT_DEC = PRIM_LAT_DEC;
this.PRIM_LONG_DEC = PRIM_LONG_DEC;
this.SOURCE_LAT_DMS = SOURCE_LAT_DMS;
this.SOURCE_LONG_DMS = SOURCE_LONG_DMS;
this.SOURCE_LAT_DEC = SOURCE_LAT_DEC;
this.SOURCE_LONG_DEC = SOURCE_LONG_DEC;
this.ELEV_IN_M = ELEV_IN_M;
this.ELEV_IN_FT = ELEV_IN_FT;
this.MAP_NAME = MAP_NAME;
this.DATE_CREATED = DATE_CREATED;
this.DATE_EDITED = DATE_EDITED;
}

// -------| Object |-----------------------

@Override
public String toString ()
{
return new StringJoiner( " | " , Gis.class.getSimpleName() + "{ " , " }" )
.add( "FEATURE_ID='" + this.FEATURE_ID + "'" )
.add( "FEATURE_NAME='" + this.FEATURE_NAME + "'" )
.toString();
}

// -------| Parsing |----------------------

static public List < Gis > parseFile ( final String path )
{
ArrayList < Gis > list = new ArrayList <>();
DateTimeFormatter f = DateTimeFormatter.ofPattern( "MM/dd/uuuu" );
try
{
Reader reader = new FileReader( path );

CSVFormat format = CSVFormat.TDF.withHeader( Gis.FIELD.class ).withFirstRecordAsHeader().withTrim().withDelimiter( '|' ); // Must pass a `char` to `withDelimiter` not a `String`, so use single-quote not double-quote.
Iterable < CSVRecord > records = format.parse( reader );
for ( CSVRecord record : records )
{
// FEATURE_ID|FEATURE_NAME|FEATURE_CLASS|STATE_ALPHA|STATE_NUMERIC|COUNTY_NAME|COUNTY_NUMERIC|PRIMARY_LAT_DMS|PRIM_LONG_DMS|PRIM_LAT_DEC|PRIM_LONG_DEC|SOURCE_LAT_DMS|SOURCE_LONG_DMS|SOURCE_LAT_DEC|SOURCE_LONG_DEC|ELEV_IN_M|ELEV_IN_FT|MAP_NAME|DATE_CREATED|DATE_EDITED

Integer FEATURE_ID = Integer.valueOf( record.get( FIELD.FEATURE_ID ) );
String FEATURE_NAME = record.get( FIELD.FEATURE_NAME );
String FEATURE_CLASS = record.get( FIELD.FEATURE_CLASS );
String STATE_ALPHA = record.get( FIELD.STATE_ALPHA );
String STATE_NUMERIC = record.get( FIELD.STATE_NUMERIC );
String COUNTY_NAME = record.get( FIELD.COUNTY_NAME );
String COUNTY_NUMERIC = record.get( FIELD.COUNTY_NUMERIC );
String PRIMARY_LAT_DMS = record.get( FIELD.PRIM_LONG_DMS );
String PRIM_LONG_DMS = record.get( FIELD.PRIM_LONG_DMS );
BigDecimal PRIM_LAT_DEC = record.get( FIELD.PRIM_LAT_DEC ).isBlank() ? null : new BigDecimal( record.get( FIELD.PRIM_LAT_DEC ) );
BigDecimal PRIM_LONG_DEC = record.get( FIELD.PRIM_LONG_DEC ).isBlank() ? null : new BigDecimal( record.get( FIELD.PRIM_LONG_DEC ) );
String SOURCE_LAT_DMS = record.get( FIELD.SOURCE_LAT_DMS );
String SOURCE_LONG_DMS = record.get( FIELD.SOURCE_LONG_DMS );
BigDecimal SOURCE_LAT_DEC = record.get( FIELD.SOURCE_LAT_DEC ).isBlank() ? null : new BigDecimal( record.get( FIELD.SOURCE_LAT_DEC ) );
BigDecimal SOURCE_LONG_DEC = record.get( FIELD.SOURCE_LONG_DEC ).isBlank() ? null : new BigDecimal( record.get( FIELD.SOURCE_LONG_DEC ) );
Integer ELEV_IN_M = record.get( FIELD.ELEV_IN_M ).isBlank() ? null : Integer.valueOf( record.get( FIELD.ELEV_IN_M ) );
Integer ELEV_IN_FT = record.get( FIELD.ELEV_IN_FT ).isBlank() ? null : Integer.valueOf( record.get( FIELD.ELEV_IN_FT ) );
String MAP_NAME = record.get( FIELD.MAP_NAME );
LocalDate DATE_CREATED = record.get( FIELD.DATE_CREATED ).isBlank() ? null : LocalDate.parse( record.get( FIELD.DATE_CREATED ) , f );
LocalDate DATE_EDITED = record.get( FIELD.DATE_EDITED ).isBlank() ? null : LocalDate.parse( record.get( FIELD.DATE_EDITED ) , f );

Gis gis = new Gis( FEATURE_ID , FEATURE_NAME , FEATURE_CLASS , STATE_ALPHA , STATE_NUMERIC , COUNTY_NAME , COUNTY_NUMERIC , PRIMARY_LAT_DMS , PRIM_LONG_DMS , PRIM_LAT_DEC , PRIM_LONG_DEC , SOURCE_LAT_DMS , SOURCE_LONG_DMS , SOURCE_LAT_DEC , SOURCE_LONG_DEC , ELEV_IN_M , ELEV_IN_FT , MAP_NAME , DATE_CREATED , DATE_EDITED );
list.add( gis );
}
} catch ( FileNotFoundException e )
{
e.printStackTrace();
} catch ( IOException e )
{
e.printStackTrace();
}
list.trimToSize();
return list;
}

// ---------| Demo (psvm) |------------------------------------------
public static void main ( String[] args )
{
if ( false ) // Experiment on a small file, a subset of data. If that works, run the huge file.
{
String path = "/Users/basilbourque/gis-small.txt";
List < Gis > list = Gis.parseFile( path );
System.out.println( "list.size(): " + list.size() );
System.out.println( "list: " + list );
} else
{
String path = "/Users/basilbourque/gis.txt";
List < Gis > list = Gis.parseFile( path );
System.out.println( "list.size(): " + list.size() );
System.out.println( "list.sublist( 0 , 10 ): " + list.subList( 0 , 10 ) );
System.out.println( "list.sublist (last 10): " + list.subList( list.size()-10 ,list.size()) );
}
}
}

运行时。

list.size(): 122669

list.sublist( 0 , 10 ): [Gis{ FEATURE_ID='2928' | FEATURE_NAME='Cibola Bridge' }, Gis{ FEATURE_ID='6185' | FEATURE_NAME='Imperial National Wildlife Refuge' }, Gis{ FEATURE_ID='8164' | FEATURE_NAME='Mohave Canyon' }, Gis{ FEATURE_ID='8174' | FEATURE_NAME='Mohave Valley' }, Gis{ FEATURE_ID='9144' | FEATURE_NAME='Palo Verde Dam' }, Gis{ FEATURE_ID='9146' | FEATURE_NAME='Palo Verde Intake' }, Gis{ FEATURE_ID='9227' | FEATURE_NAME='Parker Valley' }, Gis{ FEATURE_ID='12628' | FEATURE_NAME='Topock Gorge' }, Gis{ FEATURE_ID='14114' | FEATURE_NAME='Yuma Main Canal' }, Gis{ FEATURE_ID='22751' | FEATURE_NAME='Cibola National Wildlife Refuge' }]

list.sublist (last 10): [Gis{ FEATURE_ID='27833610' | FEATURE_NAME='Marine Corps Recruit Depot Post Office' }, Gis{ FEATURE_ID='27833611' | FEATURE_NAME='MCAS Miramar Post Office' }, Gis{ FEATURE_ID='27833612' | FEATURE_NAME='Mount McCoy Post Office' }, Gis{ FEATURE_ID='27833613' | FEATURE_NAME='NAS North Island Post Office' }, Gis{ FEATURE_ID='27833614' | FEATURE_NAME='Pala Post Office' }, Gis{ FEATURE_ID='27833615' | FEATURE_NAME='Pinon Hills Post Office' }, Gis{ FEATURE_ID='27833616' | FEATURE_NAME='Yermo Post Office' }, Gis{ FEATURE_ID='27833617' | FEATURE_NAME='Federal Covina Post Office' }, Gis{ FEATURE_ID='27833618' | FEATURE_NAME='Montalvo Post Office' }, Gis{ FEATURE_ID='27833619' | FEATURE_NAME='Beverly Hills Post Office' }]

在实际工作中,我会将解析内容移到它自己的类中,保留 Gis 类仅用于数据验证和存储。

关于java - 在 Java 中打开大型数据集和实例化数据时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56307420/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com