You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2017/08/18 15:02:22 UTC
commons-csv git commit: Better ivar name.
Repository: commons-csv
Updated Branches:
refs/heads/master 431f8236e -> 259812ec0
Better ivar name.
Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/259812ec
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/259812ec
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/259812ec
Branch: refs/heads/master
Commit: 259812ec0af308b2ceec4687ffa52b873425bb5b
Parents: 431f823
Author: Gary Gregory <ga...@gmail.com>
Authored: Fri Aug 18 09:02:19 2017 -0600
Committer: Gary Gregory <ga...@gmail.com>
Committed: Fri Aug 18 09:02:19 2017 -0600
----------------------------------------------------------------------
src/main/java/org/apache/commons/csv/CSVParser.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-csv/blob/259812ec/src/main/java/org/apache/commons/csv/CSVParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java b/src/main/java/org/apache/commons/csv/CSVParser.java
index 17d1c20..8851211 100644
--- a/src/main/java/org/apache/commons/csv/CSVParser.java
+++ b/src/main/java/org/apache/commons/csv/CSVParser.java
@@ -286,7 +286,7 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
private final Lexer lexer;
/** A record buffer for getRecord(). Grows as necessary and is reused. */
- private final List<String> record = new ArrayList<>();
+ private final List<String> recordList = new ArrayList<>();
/**
* The next record number to assign.
@@ -364,7 +364,7 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
return;
}
final String nullString = this.format.getNullString();
- this.record.add(inputClean.equals(nullString) ? null : inputClean);
+ this.recordList.add(inputClean.equals(nullString) ? null : inputClean);
}
/**
@@ -577,7 +577,7 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
*/
CSVRecord nextRecord() throws IOException {
CSVRecord result = null;
- this.record.clear();
+ this.recordList.clear();
StringBuilder sb = null;
final long startCharPosition = lexer.getCharacterPosition() + this.characterOffset;
do {
@@ -611,10 +611,10 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
}
} while (this.reusableToken.type == TOKEN);
- if (!this.record.isEmpty()) {
+ if (!this.recordList.isEmpty()) {
this.recordNumber++;
final String comment = sb == null ? null : sb.toString();
- result = new CSVRecord(this.record.toArray(new String[this.record.size()]), this.headerMap, comment,
+ result = new CSVRecord(this.recordList.toArray(new String[this.recordList.size()]), this.headerMap, comment,
this.recordNumber, startCharPosition);
}
return result;
Re: commons-csv git commit: Better ivar name.
Posted by Benedikt Ritter <br...@apache.org>.
IMHO that's a bad name as well :o)
Gary Gregory <ga...@gmail.com> schrieb am Fr. 18. Aug. 2017 um 17:37:
> We already have header*Map* ...
>
> Gary
>
> On Fri, Aug 18, 2017 at 9:23 AM, Benedikt Ritter <br...@apache.org>
> wrote:
>
> > Hello,
> >
> > I don't think this is a better name. In my opinion it's bad style to add
> > types to variable names. How about recordContents or simply content/s ?
> >
> > Regards,
> > Benedikt
> > <gg...@apache.org> schrieb am Fr. 18. Aug. 2017 um 17:02:
> >
> >> Repository: commons-csv
> >> Updated Branches:
> >> refs/heads/master 431f8236e -> 259812ec0
> >>
> >>
> >> Better ivar name.
> >>
> >> Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
> >> Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/
> >> 259812ec
> >> Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/259812ec
> >> Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/259812ec
> >>
> >> Branch: refs/heads/master
> >> Commit: 259812ec0af308b2ceec4687ffa52b873425bb5b
> >> Parents: 431f823
> >> Author: Gary Gregory <ga...@gmail.com>
> >> Authored: Fri Aug 18 09:02:19 2017 -0600
> >> Committer: Gary Gregory <ga...@gmail.com>
> >> Committed: Fri Aug 18 09:02:19 2017 -0600
> >>
> >> ----------------------------------------------------------------------
> >> src/main/java/org/apache/commons/csv/CSVParser.java | 10 +++++-----
> >> 1 file changed, 5 insertions(+), 5 deletions(-)
> >> ----------------------------------------------------------------------
> >>
> >>
> >> http://git-wip-us.apache.org/repos/asf/commons-csv/blob/
> >> 259812ec/src/main/java/org/apache/commons/csv/CSVParser.java
> >> ----------------------------------------------------------------------
> >> diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java
> >> b/src/main/java/org/apache/commons/csv/CSVParser.java
> >> index 17d1c20..8851211 100644
> >> --- a/src/main/java/org/apache/commons/csv/CSVParser.java
> >> +++ b/src/main/java/org/apache/commons/csv/CSVParser.java
> >> @@ -286,7 +286,7 @@ public final class CSVParser implements
> >> Iterable<CSVRecord>, Closeable {
> >> private final Lexer lexer;
> >>
> >> /** A record buffer for getRecord(). Grows as necessary and is
> >> reused. */
> >> - private final List<String> record = new ArrayList<>();
> >> + private final List<String> recordList = new ArrayList<>();
> >>
> >> /**
> >> * The next record number to assign.
> >> @@ -364,7 +364,7 @@ public final class CSVParser implements
> >> Iterable<CSVRecord>, Closeable {
> >> return;
> >> }
> >> final String nullString = this.format.getNullString();
> >> - this.record.add(inputClean.equals(nullString) ? null :
> >> inputClean);
> >> + this.recordList.add(inputClean.equals(nullString) ? null :
> >> inputClean);
> >> }
> >>
> >> /**
> >> @@ -577,7 +577,7 @@ public final class CSVParser implements
> >> Iterable<CSVRecord>, Closeable {
> >> */
> >> CSVRecord nextRecord() throws IOException {
> >> CSVRecord result = null;
> >> - this.record.clear();
> >> + this.recordList.clear();
> >> StringBuilder sb = null;
> >> final long startCharPosition = lexer.getCharacterPosition() +
> >> this.characterOffset;
> >> do {
> >> @@ -611,10 +611,10 @@ public final class CSVParser implements
> >> Iterable<CSVRecord>, Closeable {
> >> }
> >> } while (this.reusableToken.type == TOKEN);
> >>
> >> - if (!this.record.isEmpty()) {
> >> + if (!this.recordList.isEmpty()) {
> >> this.recordNumber++;
> >> final String comment = sb == null ? null : sb.toString();
> >> - result = new CSVRecord(this.record.toArray(new
> >> String[this.record.size()]), this.headerMap, comment,
> >> + result = new CSVRecord(this.recordList.toArray(new
> >> String[this.recordList.size()]), this.headerMap, comment,
> >> this.recordNumber, startCharPosition);
> >> }
> >> return result;
> >>
> >>
>
Re: commons-csv git commit: Better ivar name.
Posted by Claude Warren <cl...@xenei.com>.
I have no problem calling it a *List if it is a list, but I also have to
ask should it be a list. Why not just a Collection<String>? Is order
important? Are duplicates allowed (if not perhaps a Set<String> is
proper). On the other hand it is fairly localized so I am not concerned.
As for the *Map I find that proper as it is a map structure.
just my 2-cents. YMMV
Claude
On Fri, Aug 18, 2017 at 4:37 PM, Gary Gregory <ga...@gmail.com>
wrote:
> We already have header*Map* ...
>
> Gary
>
> On Fri, Aug 18, 2017 at 9:23 AM, Benedikt Ritter <br...@apache.org>
> wrote:
>
> > Hello,
> >
> > I don't think this is a better name. In my opinion it's bad style to add
> > types to variable names. How about recordContents or simply content/s ?
> >
> > Regards,
> > Benedikt
> > <gg...@apache.org> schrieb am Fr. 18. Aug. 2017 um 17:02:
> >
> >> Repository: commons-csv
> >> Updated Branches:
> >> refs/heads/master 431f8236e -> 259812ec0
> >>
> >>
> >> Better ivar name.
> >>
> >> Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
> >> Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/
> >> 259812ec
> >> Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/259812ec
> >> Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/259812ec
> >>
> >> Branch: refs/heads/master
> >> Commit: 259812ec0af308b2ceec4687ffa52b873425bb5b
> >> Parents: 431f823
> >> Author: Gary Gregory <ga...@gmail.com>
> >> Authored: Fri Aug 18 09:02:19 2017 -0600
> >> Committer: Gary Gregory <ga...@gmail.com>
> >> Committed: Fri Aug 18 09:02:19 2017 -0600
> >>
> >> ----------------------------------------------------------------------
> >> src/main/java/org/apache/commons/csv/CSVParser.java | 10 +++++-----
> >> 1 file changed, 5 insertions(+), 5 deletions(-)
> >> ----------------------------------------------------------------------
> >>
> >>
> >> http://git-wip-us.apache.org/repos/asf/commons-csv/blob/
> >> 259812ec/src/main/java/org/apache/commons/csv/CSVParser.java
> >> ----------------------------------------------------------------------
> >> diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java
> >> b/src/main/java/org/apache/commons/csv/CSVParser.java
> >> index 17d1c20..8851211 100644
> >> --- a/src/main/java/org/apache/commons/csv/CSVParser.java
> >> +++ b/src/main/java/org/apache/commons/csv/CSVParser.java
> >> @@ -286,7 +286,7 @@ public final class CSVParser implements
> >> Iterable<CSVRecord>, Closeable {
> >> private final Lexer lexer;
> >>
> >> /** A record buffer for getRecord(). Grows as necessary and is
> >> reused. */
> >> - private final List<String> record = new ArrayList<>();
> >> + private final List<String> recordList = new ArrayList<>();
> >>
> >> /**
> >> * The next record number to assign.
> >> @@ -364,7 +364,7 @@ public final class CSVParser implements
> >> Iterable<CSVRecord>, Closeable {
> >> return;
> >> }
> >> final String nullString = this.format.getNullString();
> >> - this.record.add(inputClean.equals(nullString) ? null :
> >> inputClean);
> >> + this.recordList.add(inputClean.equals(nullString) ? null :
> >> inputClean);
> >> }
> >>
> >> /**
> >> @@ -577,7 +577,7 @@ public final class CSVParser implements
> >> Iterable<CSVRecord>, Closeable {
> >> */
> >> CSVRecord nextRecord() throws IOException {
> >> CSVRecord result = null;
> >> - this.record.clear();
> >> + this.recordList.clear();
> >> StringBuilder sb = null;
> >> final long startCharPosition = lexer.getCharacterPosition() +
> >> this.characterOffset;
> >> do {
> >> @@ -611,10 +611,10 @@ public final class CSVParser implements
> >> Iterable<CSVRecord>, Closeable {
> >> }
> >> } while (this.reusableToken.type == TOKEN);
> >>
> >> - if (!this.record.isEmpty()) {
> >> + if (!this.recordList.isEmpty()) {
> >> this.recordNumber++;
> >> final String comment = sb == null ? null : sb.toString();
> >> - result = new CSVRecord(this.record.toArray(new
> >> String[this.record.size()]), this.headerMap, comment,
> >> + result = new CSVRecord(this.recordList.toArray(new
> >> String[this.recordList.size()]), this.headerMap, comment,
> >> this.recordNumber, startCharPosition);
> >> }
> >> return result;
> >>
> >>
>
--
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren
Re: commons-csv git commit: Better ivar name.
Posted by Gary Gregory <ga...@gmail.com>.
We already have header*Map* ...
Gary
On Fri, Aug 18, 2017 at 9:23 AM, Benedikt Ritter <br...@apache.org> wrote:
> Hello,
>
> I don't think this is a better name. In my opinion it's bad style to add
> types to variable names. How about recordContents or simply content/s ?
>
> Regards,
> Benedikt
> <gg...@apache.org> schrieb am Fr. 18. Aug. 2017 um 17:02:
>
>> Repository: commons-csv
>> Updated Branches:
>> refs/heads/master 431f8236e -> 259812ec0
>>
>>
>> Better ivar name.
>>
>> Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/
>> 259812ec
>> Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/259812ec
>> Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/259812ec
>>
>> Branch: refs/heads/master
>> Commit: 259812ec0af308b2ceec4687ffa52b873425bb5b
>> Parents: 431f823
>> Author: Gary Gregory <ga...@gmail.com>
>> Authored: Fri Aug 18 09:02:19 2017 -0600
>> Committer: Gary Gregory <ga...@gmail.com>
>> Committed: Fri Aug 18 09:02:19 2017 -0600
>>
>> ----------------------------------------------------------------------
>> src/main/java/org/apache/commons/csv/CSVParser.java | 10 +++++-----
>> 1 file changed, 5 insertions(+), 5 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>> http://git-wip-us.apache.org/repos/asf/commons-csv/blob/
>> 259812ec/src/main/java/org/apache/commons/csv/CSVParser.java
>> ----------------------------------------------------------------------
>> diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java
>> b/src/main/java/org/apache/commons/csv/CSVParser.java
>> index 17d1c20..8851211 100644
>> --- a/src/main/java/org/apache/commons/csv/CSVParser.java
>> +++ b/src/main/java/org/apache/commons/csv/CSVParser.java
>> @@ -286,7 +286,7 @@ public final class CSVParser implements
>> Iterable<CSVRecord>, Closeable {
>> private final Lexer lexer;
>>
>> /** A record buffer for getRecord(). Grows as necessary and is
>> reused. */
>> - private final List<String> record = new ArrayList<>();
>> + private final List<String> recordList = new ArrayList<>();
>>
>> /**
>> * The next record number to assign.
>> @@ -364,7 +364,7 @@ public final class CSVParser implements
>> Iterable<CSVRecord>, Closeable {
>> return;
>> }
>> final String nullString = this.format.getNullString();
>> - this.record.add(inputClean.equals(nullString) ? null :
>> inputClean);
>> + this.recordList.add(inputClean.equals(nullString) ? null :
>> inputClean);
>> }
>>
>> /**
>> @@ -577,7 +577,7 @@ public final class CSVParser implements
>> Iterable<CSVRecord>, Closeable {
>> */
>> CSVRecord nextRecord() throws IOException {
>> CSVRecord result = null;
>> - this.record.clear();
>> + this.recordList.clear();
>> StringBuilder sb = null;
>> final long startCharPosition = lexer.getCharacterPosition() +
>> this.characterOffset;
>> do {
>> @@ -611,10 +611,10 @@ public final class CSVParser implements
>> Iterable<CSVRecord>, Closeable {
>> }
>> } while (this.reusableToken.type == TOKEN);
>>
>> - if (!this.record.isEmpty()) {
>> + if (!this.recordList.isEmpty()) {
>> this.recordNumber++;
>> final String comment = sb == null ? null : sb.toString();
>> - result = new CSVRecord(this.record.toArray(new
>> String[this.record.size()]), this.headerMap, comment,
>> + result = new CSVRecord(this.recordList.toArray(new
>> String[this.recordList.size()]), this.headerMap, comment,
>> this.recordNumber, startCharPosition);
>> }
>> return result;
>>
>>
Re: commons-csv git commit: Better ivar name.
Posted by Benedikt Ritter <br...@apache.org>.
Hello,
I don't think this is a better name. In my opinion it's bad style to add
types to variable names. How about recordContents or simply content/s ?
Regards,
Benedikt
<gg...@apache.org> schrieb am Fr. 18. Aug. 2017 um 17:02:
> Repository: commons-csv
> Updated Branches:
> refs/heads/master 431f8236e -> 259812ec0
>
>
> Better ivar name.
>
> Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
> Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/259812ec
> Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/259812ec
> Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/259812ec
>
> Branch: refs/heads/master
> Commit: 259812ec0af308b2ceec4687ffa52b873425bb5b
> Parents: 431f823
> Author: Gary Gregory <ga...@gmail.com>
> Authored: Fri Aug 18 09:02:19 2017 -0600
> Committer: Gary Gregory <ga...@gmail.com>
> Committed: Fri Aug 18 09:02:19 2017 -0600
>
> ----------------------------------------------------------------------
> src/main/java/org/apache/commons/csv/CSVParser.java | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/commons-csv/blob/259812ec/src/main/java/org/apache/commons/csv/CSVParser.java
> ----------------------------------------------------------------------
> diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java
> b/src/main/java/org/apache/commons/csv/CSVParser.java
> index 17d1c20..8851211 100644
> --- a/src/main/java/org/apache/commons/csv/CSVParser.java
> +++ b/src/main/java/org/apache/commons/csv/CSVParser.java
> @@ -286,7 +286,7 @@ public final class CSVParser implements
> Iterable<CSVRecord>, Closeable {
> private final Lexer lexer;
>
> /** A record buffer for getRecord(). Grows as necessary and is
> reused. */
> - private final List<String> record = new ArrayList<>();
> + private final List<String> recordList = new ArrayList<>();
>
> /**
> * The next record number to assign.
> @@ -364,7 +364,7 @@ public final class CSVParser implements
> Iterable<CSVRecord>, Closeable {
> return;
> }
> final String nullString = this.format.getNullString();
> - this.record.add(inputClean.equals(nullString) ? null :
> inputClean);
> + this.recordList.add(inputClean.equals(nullString) ? null :
> inputClean);
> }
>
> /**
> @@ -577,7 +577,7 @@ public final class CSVParser implements
> Iterable<CSVRecord>, Closeable {
> */
> CSVRecord nextRecord() throws IOException {
> CSVRecord result = null;
> - this.record.clear();
> + this.recordList.clear();
> StringBuilder sb = null;
> final long startCharPosition = lexer.getCharacterPosition() +
> this.characterOffset;
> do {
> @@ -611,10 +611,10 @@ public final class CSVParser implements
> Iterable<CSVRecord>, Closeable {
> }
> } while (this.reusableToken.type == TOKEN);
>
> - if (!this.record.isEmpty()) {
> + if (!this.recordList.isEmpty()) {
> this.recordNumber++;
> final String comment = sb == null ? null : sb.toString();
> - result = new CSVRecord(this.record.toArray(new
> String[this.record.size()]), this.headerMap, comment,
> + result = new CSVRecord(this.recordList.toArray(new
> String[this.recordList.size()]), this.headerMap, comment,
> this.recordNumber, startCharPosition);
> }
> return result;
>
>
Re: commons-csv git commit: Better ivar name.
Posted by Benedikt Ritter <br...@apache.org>.
Hello,
I don't think this is a better name. In my opinion it's bad style to add
types to variable names. How about recordContents or simply content/s ?
Regards,
Benedikt
<gg...@apache.org> schrieb am Fr. 18. Aug. 2017 um 17:02:
> Repository: commons-csv
> Updated Branches:
> refs/heads/master 431f8236e -> 259812ec0
>
>
> Better ivar name.
>
> Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
> Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/259812ec
> Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/259812ec
> Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/259812ec
>
> Branch: refs/heads/master
> Commit: 259812ec0af308b2ceec4687ffa52b873425bb5b
> Parents: 431f823
> Author: Gary Gregory <ga...@gmail.com>
> Authored: Fri Aug 18 09:02:19 2017 -0600
> Committer: Gary Gregory <ga...@gmail.com>
> Committed: Fri Aug 18 09:02:19 2017 -0600
>
> ----------------------------------------------------------------------
> src/main/java/org/apache/commons/csv/CSVParser.java | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/commons-csv/blob/259812ec/src/main/java/org/apache/commons/csv/CSVParser.java
> ----------------------------------------------------------------------
> diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java
> b/src/main/java/org/apache/commons/csv/CSVParser.java
> index 17d1c20..8851211 100644
> --- a/src/main/java/org/apache/commons/csv/CSVParser.java
> +++ b/src/main/java/org/apache/commons/csv/CSVParser.java
> @@ -286,7 +286,7 @@ public final class CSVParser implements
> Iterable<CSVRecord>, Closeable {
> private final Lexer lexer;
>
> /** A record buffer for getRecord(). Grows as necessary and is
> reused. */
> - private final List<String> record = new ArrayList<>();
> + private final List<String> recordList = new ArrayList<>();
>
> /**
> * The next record number to assign.
> @@ -364,7 +364,7 @@ public final class CSVParser implements
> Iterable<CSVRecord>, Closeable {
> return;
> }
> final String nullString = this.format.getNullString();
> - this.record.add(inputClean.equals(nullString) ? null :
> inputClean);
> + this.recordList.add(inputClean.equals(nullString) ? null :
> inputClean);
> }
>
> /**
> @@ -577,7 +577,7 @@ public final class CSVParser implements
> Iterable<CSVRecord>, Closeable {
> */
> CSVRecord nextRecord() throws IOException {
> CSVRecord result = null;
> - this.record.clear();
> + this.recordList.clear();
> StringBuilder sb = null;
> final long startCharPosition = lexer.getCharacterPosition() +
> this.characterOffset;
> do {
> @@ -611,10 +611,10 @@ public final class CSVParser implements
> Iterable<CSVRecord>, Closeable {
> }
> } while (this.reusableToken.type == TOKEN);
>
> - if (!this.record.isEmpty()) {
> + if (!this.recordList.isEmpty()) {
> this.recordNumber++;
> final String comment = sb == null ? null : sb.toString();
> - result = new CSVRecord(this.record.toArray(new
> String[this.record.size()]), this.headerMap, comment,
> + result = new CSVRecord(this.recordList.toArray(new
> String[this.recordList.size()]), this.headerMap, comment,
> this.recordNumber, startCharPosition);
> }
> return result;
>
>